diff --git a/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java b/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java index a3defdd9..d1d3183b 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java +++ b/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java @@ -441,7 +441,11 @@ public class TileLevelMaintainer extends AENetworkTile if (tag == null || !tag.hasKey(NBT_STACK)) { this.requests[i] = null; } else if (this.requests[i] == null) { - this.requests[i] = new RequestInfo(tag, this); + try { + this.requests[i] = new RequestInfo(tag, this); + } catch (Exception ignored) { + this.requests[i] = null; + } } else { this.requests[i].loadFromNBT(tag); } @@ -598,9 +602,12 @@ public class TileLevelMaintainer extends AENetworkTile job = null; } - public RequestInfo(NBTTagCompound tag, TileLevelMaintainer tile) { + public RequestInfo(NBTTagCompound tag, TileLevelMaintainer tile) throws IllegalArgumentException { this.tile = tile; itemStack = AEItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_STACK)); + if (itemStack == null) { + throw new IllegalArgumentException("ItemStack cannot be null!"); + } quantity = tag.getLong(NBT_QUANTITY); batchSize = tag.getLong(NBT_BATCH); enable = tag.getBoolean(NBT_ENABLE); diff --git a/src/main/java/com/glodblock/github/crossmod/waila/tile/LevelMaintainerWailaDataProvider.java b/src/main/java/com/glodblock/github/crossmod/waila/tile/LevelMaintainerWailaDataProvider.java index 20b01d35..297c8d46 100644 --- a/src/main/java/com/glodblock/github/crossmod/waila/tile/LevelMaintainerWailaDataProvider.java +++ b/src/main/java/com/glodblock/github/crossmod/waila/tile/LevelMaintainerWailaDataProvider.java @@ -31,16 +31,17 @@ public class LevelMaintainerWailaDataProvider extends BaseWailaDataProvider { NBTTagCompound tag = tagList.getCompoundTagAt(i); if (tag == null || !tag.hasKey(TileLevelMaintainer.NBT_STACK)) continue; - TileLevelMaintainer.RequestInfo request = new TileLevelMaintainer.RequestInfo( - tag, - tileLevelMaintainer); - currentToolTip.add( - Tooltip.tileLevelMaintainerFormat( - request.getAEItemStack().getItemStack().getDisplayName(), - request.getQuantity(), - request.getBatchSize(), - request.isEnable())); - + try { + TileLevelMaintainer.RequestInfo request = new TileLevelMaintainer.RequestInfo( + tag, + tileLevelMaintainer); + currentToolTip.add( + Tooltip.tileLevelMaintainerFormat( + request.getAEItemStack().getItemStack().getDisplayName(), + request.getQuantity(), + request.getBatchSize(), + request.isEnable())); + } catch (Exception ignored) {} } } }