Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

NPE crash due to getPickBlock returning null ItemStack

sargunv opened this issue ยท 5 comments

commented

In 1.11, ItemStack became nonnull, so a null item stack should never be returned by a method (use empty itemstack instead). The BlockChiseled.pickBlock() method can return null in some cases, which will crash the game if another mod uses the value without a null-check.

Versions:

  • Forge: 1.11-13.19.1.2189
  • C&B: 13.2

Steps to reproduce:

  1. Install HWYLA and Chisels-and-Bits together.
  2. Attempt to chisel a block in Drawn Region mode.

Result:

The game crashes due to a NPE in HWYLA, but caused by C&B.

You can see the discussion in TehNut-Mods/HWYLA#31.

commented

Yep, working fine. Thanks!

commented

Please verify that the issue is fixed, https://dvs1.progwml6.com/jenkins/job/Chisels-and-Bits/61/

commented

Could this possibly get applied to the 1.10 branch and released too? I'm pretty sure I'm seeing the same problem there. Many thanks!

https://gist.github.com/tetious/c3c5e1af9965f69e103ebe090d1cf5a8

commented

It's a similar symptom, but most likely a different cause. In 1.10, null item stacks were allowed, so the exact same fix will probably not work. In your case it's getPickBlock throwing a NPE rather than returning null causing Waila/Hwyla to throw one.

commented

It isn't even the same underlying issue. Going to open a new issue. Thanks again.