summaryrefslogtreecommitdiff
path: root/src/gui/popups
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 /src/gui/popups
parent825ef1e963fd8a30e04e69f676eecc90e601f4e1 (diff)
downloadplus-b47e02f1e70a1f303bee370110448d92bc0a3684.tar.gz
plus-b47e02f1e70a1f303bee370110448d92bc0a3684.tar.bz2
plus-b47e02f1e70a1f303bee370110448d92bc0a3684.tar.xz
plus-b47e02f1e70a1f303bee370110448d92bc0a3684.zip
Do not replace text related to player if there is no localPlayer instancied
Diffstat (limited to 'src/gui/popups')
-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