fix: Fixes NPE with resistance mods in Mobile (#1199)

This commit is contained in:
Kamron Batman 2022-10-22 09:11:56 -07:00 committed by GitHub
parent f936314326
commit c711e7ab02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3172,14 +3172,17 @@ public class Mobile : IHued, IComparable<Mobile>, 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;
}
}
}