Skip to content

Commit

Permalink
More thorough input checks for isPatternMissing function
Browse files Browse the repository at this point in the history
Fixes regression introduced by #9380
ResolvedImage.fromString may now return null, which leaves CrossFaded<ResolvedImage>
with possibly have missing patterns
I have traced other code paths using ResolvedImage.fromString and have not seen
any other potential offenders
  • Loading branch information
karimnaaji committed Apr 9, 2020
1 parent 1a036c8 commit 70648a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/render/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ class Painter {
*/
isPatternMissing(image: ?CrossFaded<ResolvedImage>): boolean {
if (!image) return false;
if (!image.from || !image.to) return true;
const imagePosA = this.imageManager.getPattern(image.from.toString());
const imagePosB = this.imageManager.getPattern(image.to.toString());
return !imagePosA || !imagePosB;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64
"width": 8,
"height": 8
}
},
"zoom": 3,
Expand Down

0 comments on commit 70648a1

Please sign in to comment.