Fixes NPE with Protection Spell (#179)

This commit is contained in:
Kamron Batman 2020-07-18 19:25:15 -07:00 • committed by GitHub
parent 5052bf9af3
commit eb3f72da99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 39 deletions

View file

@ -55,7 +55,19 @@ namespace Server.Spells.Fifth
{
Mobile targ = Caster;
if (!m_Table.TryGetValue(targ, out ResistanceMod[] mods))
if (m_Table.TryGetValue(targ, out ResistanceMod[] mods))
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
m_Table.Remove(targ);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
}
else
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
@ -81,18 +93,6 @@ namespace Server.Spells.Fifth
BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true));
}
else
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
m_Table.Remove(targ);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
}
}
FinishSequence();