diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index fe7dc4acb..55b89495a 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2197,7 +2197,12 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert summon->SetHomePosition(pos); summon->InitStats(duration); - AddToMap(summon->ToCreature(), summon->GetOwnerGUID().IsPlayer() || (summoner && summoner->GetTransport())); + if (!AddToMap(summon->ToCreature(), summon->GetOwnerGUID().IsPlayer() || (summoner && summoner->GetTransport()))) + { + delete summon; + return nullptr; + } + summon->InitSummon(); //ObjectAccessor::UpdateObjectVisibility(summon); diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index f602368bc..a708a8ec8 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -857,16 +857,30 @@ public: { PreventHitEffect(effIndex); - uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue; - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB); - int32 duration = GetSpellInfo()->GetDuration(); - if (!GetOriginalCaster() || !properties) - return; - - if (TempSummon* summon = GetCaster()->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, GetOriginalCaster(), GetSpellInfo()->Id)) + if (Unit* caster = GetCaster()) { - summon->SetCreatorGUID(GetOriginalCaster()->GetGUID()); - summon->HandleSpellClick(GetCaster()); + Unit* originalCaster = GetOriginalCaster(); + if (!originalCaster) + { + return; + } + + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB); + if (!properties) + { + return; + } + + uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue; + int32 duration = GetSpellInfo()->GetDuration(); + if (TempSummon* summon = caster->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, originalCaster, GetSpellInfo()->Id)) + { + if (summon->IsInMap(caster)) + { + summon->SetCreatorGUID(originalCaster->GetGUID()); + summon->HandleSpellClick(caster); + } + } } }