Fixed risk of NullPointerException when logging container transactions
This commit is contained in:
parent
130614bfdd
commit
d2614ed6dc
2 changed files with 12 additions and 7 deletions
|
|
@ -46,10 +46,14 @@ public class ContainerLogger extends Queue {
|
|||
ItemStack[] oi1 = oldList.get(0);
|
||||
ItemStack[] oldInventory = Util.getContainerState(oi1);
|
||||
ItemStack[] newInventory = Util.getContainerState(contents);
|
||||
if (ConfigHandler.forceContainer.get(loggingContainerId) != null) {
|
||||
|
||||
List<ItemStack[]> forceList = ConfigHandler.forceContainer.get(loggingContainerId);
|
||||
if (forceList != null) {
|
||||
int forceSize = 0;
|
||||
if (!forceList.isEmpty()) {
|
||||
newInventory = Util.getContainerState(forceList.get(0));
|
||||
int forceSize = modifyForceContainer(loggingContainerId, null);
|
||||
forceSize = modifyForceContainer(loggingContainerId, null);
|
||||
}
|
||||
if (forceSize == 0) {
|
||||
ConfigHandler.forceContainer.remove(loggingContainerId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,9 +125,10 @@ public final class InventoryChangeListener extends Queue implements Listener {
|
|||
ItemStack[] containerState = Util.getContainerState(inventoryData);
|
||||
|
||||
// If items have been removed by a hopper, merge into containerState
|
||||
if (ConfigHandler.transactingChest.get(transactingChestId) != null) {
|
||||
List<Object> transactingChestList = Collections.synchronizedList(new ArrayList<>(ConfigHandler.transactingChest.get(transactingChestId)));
|
||||
if (transactingChestList.size() > 0) {
|
||||
List<Object> transactingChest = ConfigHandler.transactingChest.get(transactingChestId);
|
||||
if (transactingChest != null) {
|
||||
List<Object> transactingChestList = Collections.synchronizedList(new ArrayList<>(transactingChest));
|
||||
if (!transactingChestList.isEmpty()) {
|
||||
ItemStack[] newState = new ItemStack[containerState.length + transactingChestList.size()];
|
||||
int count = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue