From 346b4b8b20d0619cc2bf6112db24b111e1698ab2 Mon Sep 17 00:00:00 2001 From: Intelli Date: Wed, 8 May 2024 13:18:42 -0600 Subject: [PATCH] Fixed occasional NullPointerException while processing hopper transactions (fixes #539) --- .../consumer/process/ContainerTransactionProcess.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/coreprotect/consumer/process/ContainerTransactionProcess.java b/src/main/java/net/coreprotect/consumer/process/ContainerTransactionProcess.java index ea0fd99..2fc3a96 100644 --- a/src/main/java/net/coreprotect/consumer/process/ContainerTransactionProcess.java +++ b/src/main/java/net/coreprotect/consumer/process/ContainerTransactionProcess.java @@ -1,7 +1,9 @@ package net.coreprotect.consumer.process; import java.sql.PreparedStatement; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -46,8 +48,9 @@ class ContainerTransactionProcess { } } else if (loggingChestId.startsWith("#hopper")) { - if (force_size == 0 && ConfigHandler.oldContainer.get(loggingChestId).size() == 1 && ConfigHandler.transactingChest.get(transactingChestId).isEmpty()) { - int loopCount = ConfigHandler.loggingChest.get(loggingChestId); + List transactingChest = ConfigHandler.transactingChest.get(transactingChestId); + if (force_size == 0 && ConfigHandler.oldContainer.getOrDefault(loggingChestId, Collections.synchronizedList(new ArrayList<>())).size() == 1 && transactingChest != null && transactingChest.isEmpty()) { + int loopCount = ConfigHandler.loggingChest.getOrDefault(loggingChestId, 0); int maxInventorySize = (99 * 54); try { Inventory checkInventory = (Inventory) inventory;