Make GUIinventoryMenu::drawList more robust with invalid data

This commit is contained in:
Perttu Ahola 2012-06-02 15:28:12 +03:00
parent b8cf6dee3e
commit b235e4d290

@ -284,8 +284,21 @@ void GUIInventoryMenu::drawList(const ListDrawSpec &s, int phase)
font = skin->getFont();
Inventory *inv = m_invmgr->getInventory(s.inventoryloc);
assert(inv);
if(!inv){
infostream<<"GUIInventoryMenu::drawList(): WARNING: "
<<"The inventory location "
<<"\""<<s.inventoryloc.dump()<<"\" doesn't exist"
<<std::endl;
return;
}
InventoryList *ilist = inv->getList(s.listname);
if(!ilist){
infostream<<"GUIInventoryMenu::drawList(): WARNING: "
<<"The inventory list \""<<s.listname<<"\" @ \""
<<s.inventoryloc.dump()<<"\" doesn't exist"
<<std::endl;
return;
}
core::rect<s32> imgrect(0,0,imgsize.X,imgsize.Y);