aboutsummaryrefslogtreecommitdiff
path: root/src/guiInventoryMenu.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-02 15:28:12 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-03 22:31:01 +0300
commitb235e4d290e3565a2789ec5097d33b1ec9dbb5ce (patch)
tree0a5dac5bf7f2807962d9df92e1d7e24e8305f44c /src/guiInventoryMenu.cpp
parentb8cf6dee3e0f4f7e2c77dd7edf028556be09c12e (diff)
downloadminetest-b235e4d290e3565a2789ec5097d33b1ec9dbb5ce.tar.gz
minetest-b235e4d290e3565a2789ec5097d33b1ec9dbb5ce.tar.bz2
minetest-b235e4d290e3565a2789ec5097d33b1ec9dbb5ce.zip
Make GUIinventoryMenu::drawList more robust with invalid data
Diffstat (limited to 'src/guiInventoryMenu.cpp')
-rw-r--r--src/guiInventoryMenu.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/guiInventoryMenu.cpp b/src/guiInventoryMenu.cpp
index 51001eee3..e637ab78a 100644
--- a/src/guiInventoryMenu.cpp
+++ b/src/guiInventoryMenu.cpp
@@ -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);