fix(cs_transmog.cpp): add null-check preventing crash (#145)

This commit is contained in:
Stefano Borzì
2024-03-25 17:25:21 +01:00
committed by GitHub
parent e70c5da3da
commit 08e9273fcd

View File

@@ -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);