From aba7134301e0fe49cb3a6b157d226e1405753237 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 2 Jun 2012 00:33:51 +0300 Subject: on_metadata_inventory_{move,offer,take} --- src/guiInventoryMenu.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/guiInventoryMenu.cpp') diff --git a/src/guiInventoryMenu.cpp b/src/guiInventoryMenu.cpp index 823addd1b..51001eee3 100644 --- a/src/guiInventoryMenu.cpp +++ b/src/guiInventoryMenu.cpp @@ -526,24 +526,35 @@ bool GUIInventoryMenu::OnEvent(const SEvent& event) u32 s_count = 0; if(s.isValid()) - { + do{ // breakable inv_s = m_invmgr->getInventory(s.inventoryloc); - assert(inv_s); + + if(!inv_s){ + errorstream<<"InventoryMenu: The selected inventory location " + <<"\""<getList(s.listname); if(list == NULL){ errorstream<<"InventoryMenu: The selected inventory list \"" <= list->getSize()){ + break; + } + + if((u32)s.i >= list->getSize()){ errorstream<<"InventoryMenu: The selected inventory list \"" <getItem(s.i).count; + break; } - } + + s_count = list->getItem(s.i).count; + }while(0); bool identical = (m_selected_item != NULL) && s.isValid() && (inv_selected == inv_s) && -- cgit v1.2.3