summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-06 03:42:14 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-06 03:42:14 +0300
commitc53f4620bdaa1ae3fe0a15aa237ea88d28da0954 (patch)
tree1d95c01a2fee0d926518c943b6e7eb462f8f231d
parent21ebc138f263e030df216d2a09cfd3ae9f47c840 (diff)
downloadmanaplus-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.tar.gz
manaplus-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.tar.bz2
manaplus-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.tar.xz
manaplus-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.zip
Fix possible crash in popup menu.
-rw-r--r--src/gui/popupmenu.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index ea324d675..e2009ee28 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -851,20 +851,6 @@ void PopupMenu::handleLink(const std::string &link,
else if (link == "look")
{
}
- else if (link == "use" && mItem)
- {
- if (mItem->isEquipment())
- {
- if (mItem->isEquipped())
- Net::getInventoryHandler()->unequipItem(mItem);
- else
- Net::getInventoryHandler()->equipItem(mItem);
- }
- else
- {
- Net::getInventoryHandler()->useItem(mItem);
- }
- }
else if (link == "use" && mItemId)
{
if (mItemId < SPELL_MIN_ID)
@@ -1623,6 +1609,8 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
return;
mItem = item;
+ mItemId = item->getId();
+ mItemColor = item->getColor();
mWindow = parent;
mX = x;
mY = y;
@@ -1818,6 +1806,8 @@ void PopupMenu::showItemPopup(int x, int y, Item *item)
void PopupMenu::showDropPopup(int x, int y, Item *item)
{
mItem = item;
+ mItemId = item->getId();
+ mItemColor = item->getColor();
mX = x;
mY = y;
mNick = "";