From e64b091512d8bfcdf18116a1f1c05143437a97e3 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 22 Apr 2021 12:24:09 -0400 Subject: [PATCH] Fixed a crash when trying to summon a companion pet. --- Source/Game/Entities/Unit/Unit.Spells.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index a87776235..64734f1ee 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -1068,6 +1068,9 @@ namespace Game.Entities public void CastSpell(SpellCastTargets targets, uint spellId, CastSpellExtraArgs args) { + if (args == null) + args = new CastSpellExtraArgs(); + SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, args.CastDifficulty != Difficulty.None ? args.CastDifficulty : GetMap().GetDifficultyID()); if (spellInfo == null) { @@ -1075,9 +1078,6 @@ namespace Game.Entities return; } - if (args == null) - args = new CastSpellExtraArgs(); - Spell spell = new(this, spellInfo, args.TriggerFlags, args.OriginalCaster); foreach (var pair in args.SpellValueOverrides) spell.SetSpellValue(pair.Key, pair.Value);