spec counter plugin: fix array index out of bound error when accessing equipment inventory

This commit is contained in:
Adam
2018-05-10 09:06:16 -04:00
parent 4d9c58750a
commit 2320f0f31b

View File

@@ -181,7 +181,14 @@ public class SpecialCounterPlugin extends Plugin
}
Item[] items = equipment.getItems();
Item weapon = items[EquipmentInventorySlot.WEAPON.getSlotIdx()];
int weaponIdx = EquipmentInventorySlot.WEAPON.getSlotIdx();
if (items == null || weaponIdx >= items.length)
{
return null;
}
Item weapon = items[weaponIdx];
for (SpecialWeapon specialWeapon : SpecialWeapon.values())
{