summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Payet <monwarez@gmail.com>2021-08-08 13:11:21 +0200
committerThibault Payet <monwarez@gmail.com>2021-08-08 13:11:21 +0200
commitb47e02f1e70a1f303bee370110448d92bc0a3684 (patch)
treedf9d590b5c4820b6db5d62eda829665c38bd096e
parent825ef1e963fd8a30e04e69f676eecc90e601f4e1 (diff)
downloadManaVerse-b47e02f1e70a1f303bee370110448d92bc0a3684.tar.gz
ManaVerse-b47e02f1e70a1f303bee370110448d92bc0a3684.tar.bz2
ManaVerse-b47e02f1e70a1f303bee370110448d92bc0a3684.tar.xz
ManaVerse-b47e02f1e70a1f303bee370110448d92bc0a3684.zip
Do not replace text related to player if there is no localPlayer instancied
-rw-r--r--src/gui/popups/popupmenu.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index a4d217f6e..0542fd72a 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1513,10 +1513,13 @@ void PopupMenu::handleLink(const std::string &link,
replaceAll(cmd, "'ITEMCOLOR'", toString(toInt(mItemColor, int)));
replaceAll(cmd, "'BEINGTYPEID'", toString(CAST_S32(mType)));
replaceAll(cmd, "'BEINGSUBTYPEID'", toString(CAST_S32(mSubType)));
- replaceAll(cmd, "'PLAYER'", localPlayer->getName());
- replaceAll(cmd, "'EPLAYER'", escapeString(localPlayer->getName()));
- replaceAll(cmd, "'PLAYERX'", toString(localPlayer->getTileX()));
- replaceAll(cmd, "'PLAYERY'", toString(localPlayer->getTileY()));
+ if (localPlayer != nullptr)
+ {
+ replaceAll(cmd, "'PLAYER'", localPlayer->getName());
+ replaceAll(cmd, "'EPLAYER'", escapeString(localPlayer->getName()));
+ replaceAll(cmd, "'PLAYERX'", toString(localPlayer->getTileX()));
+ replaceAll(cmd, "'PLAYERY'", toString(localPlayer->getTileY()));
+ }
if (mItemIndex >= 0)
replaceAll(cmd, "'INVINDEX'", toString(mItemIndex));
else