B.A.S.E

B.A.S.E

46M Downloads

Crash when attempting to drop invalid item

Gegy opened this issue ยท 2 comments

commented

From: PracticalSpaceFireworks/PracticalSpaceFireworks#5

When an invalid item is specified, this code prints an error, but allows the code to continue:

if (item != null) {
itemStackToDrop = new ItemStack(item, 1, meta);
} else {
this.mod.getLogger().error("Could not find Item for name: " + itemString);
}

Leaving this code to crash, as isValid does not check for null:

if (ItemStackUtils.isValid(this.itemStackToDrop)) {
itemStacks.add(itemStackToDrop.copy());
} else {
mod.getLogger().fatal("Couldn't drop null ItemStack for " + getMaterialPart().getLocalizedName());
}

commented

I think Brian-Wuest/MC-Prefab#84 is the same issue?

commented

It is most likely, yes