Fix crafting

This commit is contained in:
MyNameIsBatman 2022-09-30 00:29:31 -03:00
parent 22d3ff32a2
commit f7f57e1f55
2 changed files with 4 additions and 3 deletions

View File

@ -24,7 +24,8 @@ export const FurnitureCraftingView: FC<{}> = props =>
{ {
const ingredientData = ingredients.find(data => (data.name === ingredient.itemName)); 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; return true;

View File

@ -122,7 +122,7 @@ const useFurnitureCraftingWidgetState = () =>
useEffect(() => useEffect(() =>
{ {
if(!groupItems || !groupItems.length || !ingredientNames || !ingredientNames.length) return; if(!ingredientNames || !ingredientNames.length) return;
setIngredients(prevValue => setIngredients(prevValue =>
{ {
@ -138,7 +138,7 @@ const useFurnitureCraftingWidgetState = () =>
let amountAvailable = 0; 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({ newValue.push({
name: name, name: name,