From: Perttu Ahola Date: Fri, 1 Jun 2012 16:33:20 +0000 (+0300) Subject: Add proper error messages to GUIInventoryMenu when inventory lists are invalid X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=7d6e80a423f75aa15d95233852979713d9c99625;p=zefram%2Fminetest%2Fminetest_engine.git Add proper error messages to GUIInventoryMenu when inventory lists are invalid --- diff --git a/src/guiInventoryMenu.cpp b/src/guiInventoryMenu.cpp index f3346090..c7cff329 100644 --- a/src/guiInventoryMenu.cpp +++ b/src/guiInventoryMenu.cpp @@ -531,10 +531,18 @@ bool GUIInventoryMenu::OnEvent(const SEvent& event) assert(inv_s); InventoryList *list = inv_s->getList(s.listname); - if(list != NULL && (u32) s.i < list->getSize()) - s_count = list->getItem(s.i).count; - else + if(list == NULL){ + errorstream<<"InventoryMenu: The selected inventory list " + <<"does not exist"<= list->getSize()){ + errorstream<<"InventoryMenu: The selected inventory list " + <<"is too small (i="<getItem(s.i).count; + } } bool identical = (m_selected_item != NULL) && s.isValid() &&