mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
fix(Core/Spells): Potential crashes in spell_generic and spell_item (#8810)
This commit is contained in:
@@ -1993,7 +1993,10 @@ public:
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_FALL_DOWN, true, nullptr, aurEff);
|
||||
if (eventInfo.GetActionTarget())
|
||||
{
|
||||
eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_FALL_DOWN, true, nullptr, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -2674,7 +2677,10 @@ public:
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
if (GetHitUnit())
|
||||
{
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -2719,7 +2725,10 @@ public:
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
if (GetHitUnit())
|
||||
{
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -4601,6 +4610,11 @@ public:
|
||||
Unit* caster = eventInfo.GetActionTarget();
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_GEN_BLADE_WARDING_TRIGGERED);
|
||||
|
||||
if (!caster)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 stacks = GetStackAmount();
|
||||
int32 bp = 0;
|
||||
|
||||
@@ -4656,8 +4670,10 @@ public:
|
||||
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetTargetApplication() && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// final heal
|
||||
GetTarget()->CastSpell(GetTarget(), _spellId, true, nullptr, aurEff, GetCasterGUID());
|
||||
@@ -5228,8 +5244,12 @@ public:
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Creature* vendor = GetCaster()->ToCreature())
|
||||
if (vendor->GetEntry() == NPC_AMPHITHEATER_VENDOR)
|
||||
{
|
||||
if (vendor->GetEntry() == NPC_AMPHITHEATER_VENDOR && vendor->AI())
|
||||
{
|
||||
vendor->AI()->Talk(SAY_AMPHITHEATER_VENDOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -5294,6 +5314,11 @@ public:
|
||||
|
||||
void RemoveVehicleAuras()
|
||||
{
|
||||
if (!GetHitUnit())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Unit* u = nullptr;
|
||||
if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit())
|
||||
{
|
||||
@@ -5345,6 +5370,11 @@ public:
|
||||
|
||||
void EjectPassenger(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (!GetHitUnit())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit())
|
||||
{
|
||||
if (Unit* passenger = vehicle->GetPassenger(GetEffectValue() - 1))
|
||||
|
||||
Reference in New Issue
Block a user