diff --git a/src/components/room/widgets/furniture/FurnitureCraftingView.tsx b/src/components/room/widgets/furniture/FurnitureCraftingView.tsx index 28324392..88cf5a27 100644 --- a/src/components/room/widgets/furniture/FurnitureCraftingView.tsx +++ b/src/components/room/widgets/furniture/FurnitureCraftingView.tsx @@ -24,7 +24,8 @@ export const FurnitureCraftingView: FC<{}> = props => { const ingredientData = ingredients.find(data => (data.name === ingredient.itemName)); - if (ingredientData.count < ingredient.count) return false; + + if (!ingredientData || ingredientData.count < ingredient.count) return false; } return true; diff --git a/src/hooks/rooms/widgets/furniture/useFurnitureCraftingWidget.ts b/src/hooks/rooms/widgets/furniture/useFurnitureCraftingWidget.ts index 8399a8e9..8157172f 100644 --- a/src/hooks/rooms/widgets/furniture/useFurnitureCraftingWidget.ts +++ b/src/hooks/rooms/widgets/furniture/useFurnitureCraftingWidget.ts @@ -122,7 +122,7 @@ const useFurnitureCraftingWidgetState = () => useEffect(() => { - if(!groupItems || !groupItems.length || !ingredientNames || !ingredientNames.length) return; + if(!ingredientNames || !ingredientNames.length) return; setIngredients(prevValue => { @@ -138,7 +138,7 @@ const useFurnitureCraftingWidgetState = () => let amountAvailable = 0; - for (const inventoryItem of inventoryItems) amountAvailable += inventoryItem.items.length; + if (inventoryItems) for (const inventoryItem of inventoryItems) amountAvailable += inventoryItem.items.length; newValue.push({ name: name,