Attempt to fix getItem inventory crash (by @stujones11)

This commit is contained in:
MoNTE48 2019-05-26 23:53:40 +02:00
parent 39b2cee907
commit de5f3a152d
1 changed files with 16 additions and 4 deletions

View File

@ -556,14 +556,26 @@ u32 InventoryList::getFreeSlots() const
const ItemStack& InventoryList::getItem(u32 i) const
{
assert(i < m_size); // Pre-condition
return m_items[i];
//assert(i < m_size); // Pre-condition
//return m_items[i];
if (i < m_size)
return m_items[i];
ItemStack stack = ItemStack();
return stack;
}
ItemStack& InventoryList::getItem(u32 i)
{
assert(i < m_size); // Pre-condition
return m_items[i];
//assert(i < m_size); // Pre-condition
//return m_items[i];
if (i < m_size)
return m_items[i];
ItemStack stack = ItemStack();
return stack;
}
ItemStack InventoryList::changeItem(u32 i, const ItemStack &newitem)