fix possible segfault in PlayerInventory::retrieve
This commit is contained in:
parent
a6ac154b94
commit
2d278e71c1
@ -1008,9 +1008,10 @@ ItemPtr& PlayerInventory::retrieve(InventorySlot const& slot) {
|
|||||||
|
|
||||||
if (auto es = slot.ptr<EquipmentSlot>())
|
if (auto es = slot.ptr<EquipmentSlot>())
|
||||||
return guardEmpty(m_equipment[*es]);
|
return guardEmpty(m_equipment[*es]);
|
||||||
else if (auto bs = slot.ptr<BagSlot>())
|
else if (auto bs = slot.ptr<BagSlot>()) {
|
||||||
return guardEmpty(m_bags[bs->first]->at(bs->second));
|
if (auto bag = m_bags.ptr(bs->first))
|
||||||
else if (slot.is<SwapSlot>())
|
return guardEmpty((*bag)->at(bs->second));
|
||||||
|
} else if (slot.is<SwapSlot>())
|
||||||
return guardEmpty(m_swapSlot);
|
return guardEmpty(m_swapSlot);
|
||||||
else
|
else
|
||||||
return guardEmpty(m_trashSlot);
|
return guardEmpty(m_trashSlot);
|
||||||
|
Loading…
Reference in New Issue
Block a user