[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

@ -2330,17 +2330,9 @@ TrainerSpellData const* Creature::GetTrainerSpells() const
// overwrite WorldObject function for proper name localization
const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
{
if (loc_idx >= 0)
{
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry());
if (cl)
{
if (cl->Name.size() > (size_t)loc_idx && !cl->Name[loc_idx].empty())
return cl->Name[loc_idx].c_str();
}
}
return GetName();
char const* name = GetName();
sObjectMgr.GetCreatureLocaleStrings(GetEntry(), loc_idx, &name);
return name;
}
void Creature::SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags)