Skip to content

Commit

Permalink
Add an extra check to projectile loading that ensures that the contai…
Browse files Browse the repository at this point in the history
…ned item is still valid, in case something got scrambled.
  • Loading branch information
bonii-xx committed May 10, 2015
1 parent 291db56 commit 6361efc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/library/entity/ProjectileBase.java
Expand Up @@ -605,6 +605,11 @@ public void readEntityFromNBT(NBTTagCompound tags) {
this.returnStack = ItemStack.loadItemStackFromNBT(tags.getCompoundTag("Throwable"));
onGround = tags.getByte("onGround") == 1;
//doNotRetrieve = tags.getBoolean("Retrieval");

// ensure that nothing can crash because something went wrong in the world...
if(this.returnStack == null || !(this.returnStack.getItem() instanceof ToolCore)) {
this.setDead();
}
}

@Override
Expand Down

0 comments on commit 6361efc

Please sign in to comment.