Skip to content

Commit

Permalink
dont short circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Nov 27, 2019
1 parent 40e86d3 commit 3e4e2ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/render/image_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,20 @@ class ImageManager extends Evented {
}

_validate(id: string, image: StyleImage) {
let valid = true;
if (!this._validateStretch(image.stretchX, image.data && image.data.width)) {
this.fire(new ErrorEvent(new Error(`Image "${id}" has invalid "stretchX" value`)));
return false;
valid = false;
}
if (!this._validateStretch(image.stretchY, image.data && image.data.height)) {
this.fire(new ErrorEvent(new Error(`Image "${id}" has invalid "stretchY" value`)));
return false;
valid = false;
}
if (!this._validateContent(image.content, image)) {
this.fire(new ErrorEvent(new Error(`Image "${id}" has invalid "content" value`)));
return false;
valid = false;
}
return true;
return valid;
}

_validateStretch(stretch: ?Array<[number, number]> | void, size: number) {
Expand Down

0 comments on commit 3e4e2ae

Please sign in to comment.