Attempt to fix getItem inventory crash (by @stujones11)
This commit is contained in:
parent
39b2cee907
commit
de5f3a152d
|
@ -556,14 +556,26 @@ u32 InventoryList::getFreeSlots() const
|
||||||
|
|
||||||
const ItemStack& InventoryList::getItem(u32 i) const
|
const ItemStack& InventoryList::getItem(u32 i) const
|
||||||
{
|
{
|
||||||
assert(i < m_size); // Pre-condition
|
//assert(i < m_size); // Pre-condition
|
||||||
return m_items[i];
|
//return m_items[i];
|
||||||
|
|
||||||
|
if (i < m_size)
|
||||||
|
return m_items[i];
|
||||||
|
|
||||||
|
ItemStack stack = ItemStack();
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack& InventoryList::getItem(u32 i)
|
ItemStack& InventoryList::getItem(u32 i)
|
||||||
{
|
{
|
||||||
assert(i < m_size); // Pre-condition
|
//assert(i < m_size); // Pre-condition
|
||||||
return m_items[i];
|
//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)
|
ItemStack InventoryList::changeItem(u32 i, const ItemStack &newitem)
|
||||||
|
|
Loading…
Reference in New Issue