Null Pointer in 1.12 recipe manager
dshadowwolf opened this issue ยท 2 comments
Intro:
First seen on the BlameJared Discord, a user of CraftTweaker was seeing an NPE triggered by a script. On tracking it down, it came back to a pair of non-existent items.
Issue Description:
CraftTweaker will crash with a NullPointerError if a non-existent item is referenced in a call to recipes.remove()
What happens:
At line 618 of crafttwaker.mc1120.recipes.MCRecipeManager there are insufficient checks for stack validity, leading to an attempt to dereference a Null Pointer in a called method at line 630 of the same file.
This triggers a classic Java Null Pointer Exception and crash.
What you expected to happen:
Safeguards to ignore the null/nonexistent item and continue processing, with a log-message recording the issue.
Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):
Any reference to a nonexistent item, such as recipes.remove(<projecte:rm_furnace_lit>);
crafttweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):
Unavailable at this time
Affected Versions (Do not use "latest"):
- Minecraft: 1.12.0
- Forge: 14.23.5.2837
- Crafttweaker: 4.1.18
- Using a server: Not for a confirmation test, should still apply
- If yes, does the client have the exact same scripts?
Your most recent log file where the issue was present:
If you provide an invalid Item BH, then /ct syntax
will already tell you that you have errors in your script.
It is true that we might have to add a check there but generally, you shouldn't even try to run your scripts if they error on you beforehand.