Core/Commands: Fix NULL dereference crash in .npc set link
Fix NULL dereference crash in .npc set link happening when passing a not-existent Creature guid as parameter, es. ".npc set link -1" .
Issue spotted by static analysis, added in c05ed659cb
This commit is contained in:
1 parent
fb1daeb44c
commit
8669633921
1 file changed
+5
@@ -1412,6 +1412,11 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
|
||||
}
|
||||
|
||||
const CreatureData* slave = GetCreatureData(linkedGuidLow);
|
||||
if (!slave)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow);
|
||||
return false;
|
||||
}
|
||||
|
||||
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
|
||||
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
|
||||
|
||||
Reference in new issue
Block a user