changeset 1944:02bc0fac639f

fixing inventory right click crash
author Grumpy7
date Fri, 25 Oct 2013 00:51:32 -0700
parents c193d289f0a5
children 431d3da6e945
files UI/UIPopup.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UIPopup.cpp	Thu Oct 24 23:22:46 2013 -0700
+++ b/UI/UIPopup.cpp	Fri Oct 25 00:51:32 2013 -0700
@@ -1602,6 +1602,8 @@
 
   pMouse->GetCursorPos(&cursor);
   int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1;
+  if (item_pid == -1) //added here to avoid crash
+    return;
   auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
 
   if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(вещи вне инвентаря)