Skip to content

Commit

Permalink
fix(cs_transmog.cpp): add null-check preventing crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias committed Mar 25, 2024
1 parent e70c5da commit 1995016
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cs_transmog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1995016

Please sign in to comment.