Core/Commands: Fixes a crash when spell doesnt have Effect

This commit is contained in:
hondacrx
2021-03-15 01:20:23 -04:00
parent a86ae087a3
commit 43ff75de84
+2 -2
View File
@@ -1128,9 +1128,9 @@ namespace Game.Chat
bool known = target && target.HasSpell(spellInfo.Id);
SpellEffectInfo effect = spellInfo.GetEffect(0);
bool learn = (effect.Effect == SpellEffectName.LearnSpell);
bool learn = effect?.Effect == SpellEffectName.LearnSpell;
SpellInfo learnSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, spellInfo.Difficulty);
SpellInfo learnSpellInfo = effect != null ? Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, spellInfo.Difficulty) : null;
bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent);
bool passive = spellInfo.IsPassive();