Skip to content

Commit 0c9f226

Browse files
authored
Merge pull request #923 from the-hideout/fix-map-crash
Fix map crash
2 parents 3df13b5 + bf83539 commit 0c9f226

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/features/maps/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ export const useMapImages = () => {
133133
if (imageData.altMaps) {
134134
for (const altKey of imageData.altMaps) {
135135
const altApiMap = maps.find(map => map.normalizedName === altKey);
136+
if (!altApiMap) {
137+
// alt map is missing; so we skip it
138+
continue;
139+
}
136140
apiImageDataMerge(mapGroup, {
137141
...imageData,
138142
key: altKey,

src/pages/map/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,9 @@ function Map() {
10651065
}
10661066
if (obj.possibleLocations) {
10671067
for (const loc of obj.possibleLocations) {
1068+
if (!loc.map?.id) {
1069+
continue;
1070+
}
10681071
if (loc.map.id !== mapData.id) {
10691072
continue;
10701073
}
@@ -1103,7 +1106,7 @@ function Map() {
11031106
}
11041107
if (obj.zones) {
11051108
for (const zone of obj.zones) {
1106-
if (zone.map.id !== mapData.id) {
1109+
if (!zone.map?.id || zone.map.id !== mapData.id) {
11071110
continue;
11081111
}
11091112
if (!positionIsInBounds(zone.position)) {

0 commit comments

Comments
 (0)