Skip to content

Commit db0911c

Browse files
committed
Fix NPE around EntityStats
1 parent e438e18 commit db0911c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/studio/magemonkey/divinity/stats/EntityStats.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ public synchronized List<ItemStack> getEquipment() {
414414
private void updateInventory() {
415415
this.inventory.clear();
416416

417-
ItemStack[] armor = this.equipment.getArmorContents();
417+
ItemStack[] armor = new ItemStack[0];
418+
if (this.equipment != null) {
419+
armor = this.equipment.getArmorContents();
420+
}
418421
Arrays.stream(armor)
419422
.filter(item -> item != null && !ItemUT.isAir(item))
420423
.forEach(this.inventory::add);
@@ -593,7 +596,7 @@ private void applyBonusAttribute(@NotNull NBTAttribute att, double value) {
593596
} catch (Exception ignored) {
594597
}
595598

596-
String attKey = VersionManager.getCompat().getAttributeKey(attMod);
599+
String attKey = VersionManager.getCompat().getAttributeKey(attMod);
597600
String targetKey = VersionManager.getCompat().getAttributeKey(att);
598601
if (Compat.ATTRIBUTE_BONUS_UUID.equals(uuid) || targetKey.equals(attKey)) {
599602
if (attMod.getAmount() == value) {

0 commit comments

Comments
 (0)