fix(Core/Channels): Don't use deleted pointer in channel name creation. (#21435)

This commit is contained in:
Anton Popovichenko
2025-02-13 21:39:29 +01:00
committed by GitHub
parent 0db39f76de
commit db49562a6a

View File

@@ -550,17 +550,16 @@ void Player::UpdateLocalChannels(uint32 newZone)
// names are not changing // names are not changing
char new_channel_name_buf[100]; char new_channel_name_buf[100];
char const* currentNameExt; std::string currentNameExt;
if (channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY) if (channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY)
currentNameExt = sObjectMgr->GetAcoreStringForDBCLocale( currentNameExt = sObjectMgr->GetAcoreStringForDBCLocale(LANG_CHANNEL_CITY);
LANG_CHANNEL_CITY).c_str();
else else
currentNameExt = current_zone_name.c_str(); currentNameExt = current_zone_name;
snprintf(new_channel_name_buf, 100, snprintf(new_channel_name_buf, 100,
channel->pattern[m_session->GetSessionDbcLocale()], channel->pattern[m_session->GetSessionDbcLocale()],
currentNameExt); currentNameExt.c_str());
joinChannel = cMgr->GetJoinChannel(new_channel_name_buf, joinChannel = cMgr->GetJoinChannel(new_channel_name_buf,
channel->ChannelID); channel->ChannelID);