jaredlll08 / ModTweaker

ModTweaker is an addon for CraftTweaker, which provides Integration for an amount of mods.
MIT License
68 stars 63 forks source link

NullPointerException when removing Thaumcraft6 Crucible recipe by name #721

Closed DreamThorn closed 5 years ago

DreamThorn commented 5 years ago

In com.blamejared.compat.thaumcraft.handlers.handlers.Crucible on line 90 You should check whether output is null before checking whether it is empty.

Here is the relevant piece from my log:

[AVAILABLE][CLIENT][INFO] Altering Crucible Recipe(s) for Unknown item [AVAILABLE][CLIENT][ERROR] Error while applying actions java.lang.NullPointerException at com.blamejared.compat.thaumcraft.handlers.handlers.Crucible$Remove.apply(Crucible.java:90) at crafttweaker.runtime.CrTTweaker.apply(CrTTweaker.java:57) at crafttweaker.CraftTweakerAPI.apply(CraftTweakerAPI.java:146) at java.lang.Iterable.forEach(Unknown Source) at com.blamejared.ModTweaker.loadComplete(ModTweaker.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:624) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:752) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:535) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:3931) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

jaredlll08 commented 5 years ago

Or you could follow our template and make all of our lives easier. If you don't do anything stupid, the output shouldn't be null.

DreamThorn commented 5 years ago

Sorry about not using the template. I would have done that if I was merely reporting the bug.

Instead, I decided to look at the code and debug it myself, so I was just telling you about the fix that I came up with.

A different way to fix it would be to change that "if" to an "else if".