[11743] Fixed auction crash in case missing localization for only some items

Source crash in missing locale strings array size check before access
to it in locale structure.

Also move repeating code for access to wide used localization string arrays to ObjectMgr functions.
This commit is contained in:
VladimirMangos 2011-07-19 00:35:16 +04:00
parent bc171d5f97
commit 3e0cacbdaf
15 changed files with 203 additions and 315 deletions

View file

@ -940,13 +940,11 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
// save new item before send
markItem->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex();
// subject: item name
std::string subject = markProto->Name1;
int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex();
if (loc_idx >= 0 )
if (ItemLocale const *il = sObjectMgr.GetItemLocale(markProto->ItemId))
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
subject = il->Name[loc_idx];
sObjectMgr.GetItemLocaleStrings(markProto->ItemId, loc_idx, &subject);
// text
std::string textFormat = plr->GetSession()->GetMangosString(LANG_BG_MARK_BY_MAIL);