From b47e02f1e70a1f303bee370110448d92bc0a3684 Mon Sep 17 00:00:00 2001 From: Thibault Payet Date: Sun, 8 Aug 2021 13:11:21 +0200 Subject: Do not replace text related to player if there is no localPlayer instancied --- src/gui/popups/popupmenu.cpp | 11 +++++++---- 1 file 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 -- cgit v1.2.3-70-g09d2