Skip to content

Commit 15dfc8b

Browse files
authored
Merge pull request #1175 from the-hideout/map-crash-fix
fix map page crash
2 parents f1432bf + 00e729c commit 15dfc8b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/pages/map/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,8 +1861,10 @@ function Map() {
18611861
let markerTitle = t('Loose Loot');
18621862
let className = '';
18631863
const markerCategories = lootItems.reduce((markerCategories, item) => {
1864-
const category = handbook.handbookCategories.find(c => c.id === item.handbookCategories[0].id);
1865-
markerCategories.add(category);
1864+
const category = handbook.handbookCategories.find(c => c.id === item.handbookCategories[0]?.id);
1865+
if (category) {
1866+
markerCategories.add(category);
1867+
}
18661868
return markerCategories;
18671869
}, new Set());
18681870
if (lootItems.length === 1) {
@@ -1914,7 +1916,10 @@ function Map() {
19141916
lootLink.append(`${lootItem.name}`);
19151917
}
19161918
popupContent.append(lootLink);
1917-
const category = handbook.handbookCategories.find(c => c.id === lootItem.handbookCategories[0].id);
1919+
const category = handbook.handbookCategories.find(c => c.id === lootItem.handbookCategories[0]?.id);
1920+
if (!category) {
1921+
continue;
1922+
}
19181923
markerCategories.add(category.id);
19191924
if (!looseLootLayers[category.normalizedName]) {
19201925
looseLootLayers[category.normalizedName] = {

0 commit comments

Comments
 (0)