From ee8067d199cf1bc3d74cb39deff5d71f6c84c320 Mon Sep 17 00:00:00 2001 From: Egor Koleda Date: Tue, 19 Apr 2022 23:29:47 +0300 Subject: [PATCH] Update ThaumcraftInvHelper.java Add nullability checks to ThaumcraftInvHelper#compareTagsRelaxed to prevent crashing when the item does not have an NBT tag at all. --- ThaumcraftInvHelper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ThaumcraftInvHelper.java b/ThaumcraftInvHelper.java index 35bd01b..4b25999 100644 --- a/ThaumcraftInvHelper.java +++ b/ThaumcraftInvHelper.java @@ -94,8 +94,11 @@ else if (!prime.isEmpty() && !other.isEmpty()) } public static boolean compareTagsRelaxed(NBTTagCompound prime, NBTTagCompound other) { - for (String key : prime.getKeySet()) { - if (!other.hasKey(key) || !prime.getTag(key).equals(other.getTag(key))) { + if (prime == null) { + return true; + } + for (String key : prime.getKeySet()) { + if (other == null || !other.hasKey(key) || !prime.getTag(key).equals(other.getTag(key))) { return false; } }