ModTweaker

ModTweaker

88M Downloads

NullPointerException crash when calling ITICMaterial.harvestLevelHead

Krutoy242 opened this issue ยท 2 comments

commented

Issue Description:

Calling getter from some ITICMaterial could cause crash and NPE exception.

Feather (not have Head stats) for example:

print(<ticmat:feather>.harvestLevelHead);

Crash report (used another actual code rather then example above, but same getter):

java.lang.NullPointerException: Ticking block entity
    at com.blamejared.compat.tconstruct.materials.TICMaterial.getHarvestLevelHead(TICMaterial.java:73)
    at equipment\Recycle_tcon.getShards(equipment\recycle_tcon.zs:256)
[...]

This can't be avoided from .zs script, because i unable to check if material has some stats.

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2855
  • Crafttweaker: 4.1.20.660
  • ModTweaker: 4.0.20.4
  • MTLib: 3.0.7

Your most recent log file where the issue was present:

debug.log

commented

You can now check if a material has a particular stat, but it will still error like this if you perform the get function without checking (because the method can't actually return null).

commented

Thank you!