diff --git a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp index 5e8f39de..ad4d2687 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp @@ -107,7 +107,7 @@ bool UInventoryComponent::IsRoomAvailable(UBaseItem* Item, const int TopLeftInde TileToCheck.X = i; TileToCheck.Y = j; if (!IsTileValid(TileToCheck)) return false; - const TTuple ItemAtIndex = GetItemAtIndex(TileToIndex(TileToCheck)); + TTuple ItemAtIndex = GetItemAtIndex(TileToIndex(TileToCheck)); if (ItemAtIndex.Get<1>()) return false; if (IsValid(ItemAtIndex.Get<0>())) return true; } @@ -126,6 +126,7 @@ FInventoryTile UInventoryComponent::IndexToTile(const int Index) const TTuple UInventoryComponent::GetItemAtIndex(const int Index) { if (!InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false); + if (!IsValid(InventoryItems[Index])) return MakeTuple(nullptr, false); return MakeTuple(InventoryItems[Index], true); }