1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-11-05 17:05:05 -05:00

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

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