From c711e7ab02d6dd7bff1222686f9d4529c6807163 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 22 Oct 2022 09:11:56 -0700 Subject: [PATCH] fix: Fixes NPE with resistance mods in Mobile (#1199) --- Projects/Server/Mobiles/Mobile.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 18bc3d50e..80c47987b 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -3172,14 +3172,17 @@ public class Mobile : IHued, IComparable, ISpawnable, IObjectPropertyLis Resistances[3] += BasePoisonResistance; Resistances[4] += BaseEnergyResistance; - for (var i = 0; i < _resistanceMods.Count; i++) + if (_resistanceMods != null) { - var mod = _resistanceMods[i]; - var v = (int)mod.Type; - - if (v >= 0 && v < Resistances.Length) + for (var i = 0; i < _resistanceMods.Count; i++) { - Resistances[v] += mod.Offset; + var mod = _resistanceMods[i]; + var v = (int)mod.Type; + + if (v >= 0 && v < Resistances.Length) + { + Resistances[v] += mod.Offset; + } } }