Skip to content

Commit 2ed1e13

Browse files
authored
Fix for issue 9518 (#9520)
* Add regression test for #9518 * More thorough input checks for isPatternMissing function Fixes regression introduced by #9380 ResolvedImage.fromString may now return null, which potentially leaves CrossFaded<ResolvedImage> with missing image patterns I have traced other code paths using ResolvedImage.fromString and have not seen any other potential offenders
1 parent 99e9a24 commit 2ed1e13

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/render/painter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ class Painter {
589589
*/
590590
isPatternMissing(image: ?CrossFaded<ResolvedImage>): boolean {
591591
if (!image) return false;
592+
if (!image.from || !image.to) return true;
592593
const imagePosA = this.imageManager.getPattern(image.from.toString());
593594
const imagePosB = this.imageManager.getPattern(image.to.toString());
594595
return !imagePosA || !imagePosB;
69 Bytes
Loading
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": 8,
3+
"metadata": {
4+
"test": {
5+
"width": 8,
6+
"height": 8
7+
}
8+
},
9+
"zoom": 3,
10+
"sources": {},
11+
"sprite": "local://sprites/emerald",
12+
"layers": [
13+
{
14+
"id": "background",
15+
"type": "background",
16+
"paint": {
17+
"background-pattern": [
18+
"step",
19+
["zoom"],
20+
"",
21+
5,
22+
"cemetery_icon"
23+
]
24+
}
25+
}
26+
]
27+
}

0 commit comments

Comments
 (0)