CraftTweaker

CraftTweaker

151M Downloads

java.lang.NullPointerException

YaibaToKen opened this issue ยท 4 comments

commented

Issue Description:

CraftTweaker throws a NPE when attempting to load the gist'd script. Required help to debug it.

What happens:

CraftTweaker throws a NPE when attempting to load the gist'd script.

What you expected to happen:

Expected the script to be loaded properly.

Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):

https://gist.github.com/YaibaToKen/8bab7f7368e7d8702053d8e1abbb27e6

Minetweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):

https://gist.github.com/YaibaToKen/56bab444801a825c462d390ddb84609e


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.3.2679
  • Crafttweaker: 1.12-4.1.8

Your most recent log file where the issue was present:

https://gist.github.com/YaibaToKen/9b00e0b79b3555052b6b08e78ed18c23

commented

your string array doesn't have any strings in it...

strings need to be inside "
try that and get back to me please :)

commented

Shoot... such a basic mistake >.< Didn't even think to check that.

Should a foreach really crash because the collection received is empty? Shouldn't it simply not execute the loop as there are no elements to iterate over? It's not like the array had not been initialized... I reckon that doesn't happen in the languages I usually work with :P rather, the script in question should simply throw an error about not finding the variables in the array xD since they had not been declared. IMHO of course.

Though it's still throwing a NPE all the same :( I've updated the gist with the script.

commented

You don't close the function changeRecipesForMaterial

You are missing a } before you start val materials

commented

thanks :D got it all sorted out now