From b0a141bd09b7e02e5408455587bf6f4f4c672362 Mon Sep 17 00:00:00 2001 From: Raoul Van den Berge Date: Wed, 3 Feb 2016 23:17:38 +0100 Subject: [PATCH] fix bug where StorageItem compared NBT badly with null --- .../storagecraft/storage/StorageItem.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/storagecraft/storage/StorageItem.java b/src/main/java/storagecraft/storage/StorageItem.java index 48ce1d78c..bf253dc96 100644 --- a/src/main/java/storagecraft/storage/StorageItem.java +++ b/src/main/java/storagecraft/storage/StorageItem.java @@ -133,10 +133,18 @@ public class StorageItem if ((flags & InventoryUtils.COMPARE_NBT) == InventoryUtils.COMPARE_NBT) { - if (tag != null && !tag.equals(other.getTag())) + if ((tag != null && other.getTag() == null) || (tag == null && other.getTag() != null)) { return false; } + + if (tag != null && other.getTag() != null) + { + if (!tag.equals(other.getTag())) + { + return false; + } + } } if ((flags & InventoryUtils.COMPARE_QUANTITY) == InventoryUtils.COMPARE_QUANTITY) @@ -162,10 +170,18 @@ public class StorageItem if ((flags & InventoryUtils.COMPARE_NBT) == InventoryUtils.COMPARE_NBT) { - if (tag != null && !tag.equals(stack.getTagCompound())) + if ((tag != null && stack.getTagCompound() == null) || (tag == null && stack.getTagCompound() != null)) { return false; } + + if (tag != null && stack.getTagCompound() != null) + { + if (!tag.equals(stack.getTagCompound())) + { + return false; + } + } } if ((flags & InventoryUtils.COMPARE_QUANTITY) == InventoryUtils.COMPARE_QUANTITY)