Make GUIinventoryMenu::drawList more robust with invalid data

master
Perttu Ahola 2012-06-02 15:28:12 +03:00
parent b8cf6dee3e
commit b235e4d290
1 changed files with 14 additions and 1 deletions

View File

@ -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);