even more robust handling of unfitting items

This commit is contained in:
Matt Dunn-Rankin 2020-04-25 04:46:40 -07:00
parent bed3cf7227
commit aded259f1b

View file

@ -176,6 +176,9 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
}, },
}); });
const itemToAdd = items.find((i) => i.id === itemIdToAdd); const itemToAdd = items.find((i) => i.id === itemIdToAdd);
if (!itemToAdd.appearanceOn) {
return [];
}
const itemToAddZoneIds = itemToAdd.appearanceOn.layers.map((l) => l.zone.id); const itemToAddZoneIds = itemToAdd.appearanceOn.layers.map((l) => l.zone.id);
const wornItems = Array.from(wornItemIds).map((id) => const wornItems = Array.from(wornItemIds).map((id) =>
items.find((i) => i.id === id) items.find((i) => i.id === id)
@ -183,6 +186,9 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
const conflictingIds = []; const conflictingIds = [];
for (const wornItem of wornItems) { for (const wornItem of wornItems) {
if (!wornItem.appearanceOn) {
continue;
}
const wornItemZoneIds = wornItem.appearanceOn.layers.map((l) => l.zone.id); const wornItemZoneIds = wornItem.appearanceOn.layers.map((l) => l.zone.id);
const hasConflict = wornItemZoneIds.some((zid) => const hasConflict = wornItemZoneIds.some((zid) =>