summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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