From 08e9273fcdc6057336019945faf2fccd680e948a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefano=20Borz=C3=AC?= Date: Mon, 25 Mar 2024 17:25:21 +0100 Subject: [PATCH] fix(cs_transmog.cpp): add null-check preventing crash (#145) --- src/cs_transmog.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cs_transmog.cpp b/src/cs_transmog.cpp index 02871ca..d35c9fd 100644 --- a/src/cs_transmog.cpp +++ b/src/cs_transmog.cpp @@ -144,10 +144,12 @@ public: std::string itemQuality = tempStream.str(); std::string itemName = itemTemplate->Name1; - // get locale item name - int loc_idex = target->GetSession()->GetSessionDbLocaleIndex(); - if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemId)) - ObjectMgr::GetLocaleString(il->Name, loc_idex, itemName); + if (target) { + // get locale item name + int loc_idex = target->GetSession()->GetSessionDbLocaleIndex(); + if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemId)) + ObjectMgr::GetLocaleString(il->Name, loc_idex, itemName); + } std::string playerName = player->GetName(); std::string nameLink = handler->playerLink(playerName);