Skip to content

Commit

Permalink
Merge pull request #923 from the-hideout/fix-map-crash
Browse files Browse the repository at this point in the history
Fix map crash
  • Loading branch information
Razzmatazzz authored Apr 12, 2024
2 parents 3df13b5 + bf83539 commit 0c9f226
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/features/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ export const useMapImages = () => {
if (imageData.altMaps) {
for (const altKey of imageData.altMaps) {
const altApiMap = maps.find(map => map.normalizedName === altKey);
if (!altApiMap) {
// alt map is missing; so we skip it
continue;
}
apiImageDataMerge(mapGroup, {
...imageData,
key: altKey,
Expand Down
5 changes: 4 additions & 1 deletion src/pages/map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,9 @@ function Map() {
}
if (obj.possibleLocations) {
for (const loc of obj.possibleLocations) {
if (!loc.map?.id) {
continue;
}
if (loc.map.id !== mapData.id) {
continue;
}
Expand Down Expand Up @@ -1103,7 +1106,7 @@ function Map() {
}
if (obj.zones) {
for (const zone of obj.zones) {
if (zone.map.id !== mapData.id) {
if (!zone.map?.id || zone.map.id !== mapData.id) {
continue;
}
if (!positionIsInBounds(zone.position)) {
Expand Down

0 comments on commit 0c9f226

Please sign in to comment.