Fixed risk of NullPointerException when logging container transactions

This commit is contained in:
Intelli 2021-07-25 16:53:58 -06:00
parent 130614bfdd
commit d2614ed6dc
2 changed files with 12 additions and 7 deletions

View file

@ -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);
newInventory = Util.getContainerState(forceList.get(0));
int forceSize = modifyForceContainer(loggingContainerId, null);
List<ItemStack[]> forceList = ConfigHandler.forceContainer.get(loggingContainerId);
if (forceList != null) {
int forceSize = 0;
if (!forceList.isEmpty()) {
newInventory = Util.getContainerState(forceList.get(0));
forceSize = modifyForceContainer(loggingContainerId, null);
}
if (forceSize == 0) {
ConfigHandler.forceContainer.remove(loggingContainerId);
}