From aded259f1b46fde55680372fb6c73094c9229aeb Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Sat, 25 Apr 2020 04:46:40 -0700 Subject: [PATCH] even more robust handling of unfitting items --- src/useOutfitState.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/useOutfitState.js b/src/useOutfitState.js index d15242f..9938e7d 100644 --- a/src/useOutfitState.js +++ b/src/useOutfitState.js @@ -176,6 +176,9 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) { }, }); const itemToAdd = items.find((i) => i.id === itemIdToAdd); + if (!itemToAdd.appearanceOn) { + return []; + } const itemToAddZoneIds = itemToAdd.appearanceOn.layers.map((l) => l.zone.id); const wornItems = Array.from(wornItemIds).map((id) => items.find((i) => i.id === id) @@ -183,6 +186,9 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) { const conflictingIds = []; for (const wornItem of wornItems) { + if (!wornItem.appearanceOn) { + continue; + } const wornItemZoneIds = wornItem.appearanceOn.layers.map((l) => l.zone.id); const hasConflict = wornItemZoneIds.some((zid) =>