Fixed a crash when trying to summon a companion pet.

This commit is contained in:
hondacrx
2021-04-22 12:24:09 -04:00
parent e4a5dbb0ba
commit e64b091512
+3 -3
View File
@@ -1068,6 +1068,9 @@ namespace Game.Entities
public void CastSpell(SpellCastTargets targets, uint spellId, CastSpellExtraArgs args) 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()); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, args.CastDifficulty != Difficulty.None ? args.CastDifficulty : GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
@@ -1075,9 +1078,6 @@ namespace Game.Entities
return; return;
} }
if (args == null)
args = new CastSpellExtraArgs();
Spell spell = new(this, spellInfo, args.TriggerFlags, args.OriginalCaster); Spell spell = new(this, spellInfo, args.TriggerFlags, args.OriginalCaster);
foreach (var pair in args.SpellValueOverrides) foreach (var pair in args.SpellValueOverrides)
spell.SetSpellValue(pair.Key, pair.Value); spell.SetSpellValue(pair.Key, pair.Value);