From 199501602bb037c21841c05f2a056d8f889d2fb9 Mon Sep 17 00:00:00 2001 From: Helias Date: Mon, 25 Mar 2024 17:00:23 +0100 Subject: [PATCH] fix(cs_transmog.cpp): add null-check preventing crash --- 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 02871cae..d35c9fda 100644 --- a/src/cs_transmog.cpp +++ b/src/cs_transmog.cpp @@ -144,10 +144,12 @@ class transmog_commandscript : public CommandScript 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);