gbl / AdvancementInfo

MIT License
41 stars 34 forks source link

Crash while filtering if Armor Statues from Vanilla Tweaks is installed and search text is a subset of word `enable` #11

Open James103 opened 2 years ago

James103 commented 2 years ago

AdvancementInfo 1.17.1-fabric0.36.1-1.3 Fabric API 0.37.2+1.17 Minecraft 1.17.1 Java 16

When attempting to filter with empty search text, the client crashes with the following stack trace:

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_454.method_2309()" because "tab" is null
    at Not Enough Crashes deobfuscated stack trace.(1.17.1+build.37)
    at de.guntram.mcmod.advancementinfo.AdvancementInfo.setMatchingFrom(AdvancementInfo.java:134)
    at net.minecraft.client.gui.screen.advancement.AdvancementsScreen.handler$bap000$redirectKeysToSearch(AdvancementsScreen:723)
    at net.minecraft.client.gui.screen.advancement.AdvancementsScreen.keyPressed(AdvancementsScreen)
    at net.minecraft.client.Keyboard.method_1454(Keyboard:374)
    at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen:490)
    at net.minecraft.client.Keyboard.onKey(Keyboard:370)
    at net.minecraft.client.Keyboard.method_22678(Keyboard:462)
    at net.minecraft.util.thread.ThreadExecutor.execute(ThreadExecutor:101)
    at net.minecraft.client.Keyboard.method_22676(Keyboard:462)
    at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:37)
    at org.lwjgl.system.JNI.invokeV(Native Method)
    at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101)
    at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem:165)
    at net.minecraft.client.util.Window.swapBuffers(Window:310)
    at net.minecraft.client.MinecraftClient.render(MinecraftClient:1137)
    at net.minecraft.client.MinecraftClient.run(MinecraftClient:728)
    at net.minecraft.client.main.Main.main(Main:217)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:567)
    at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:234)
    at net.fabricmc.loader.launch.knot.Knot.launch(Knot.java:153)
    at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:28)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:567)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

This occurs both with AdvancementInfo 1.17.1-fabric0.36.1-1.2.1 and 1.17.1-fabric0.36.1-1.3. Note that this does not occur if the search text is not a subset of the word enable (for which the empty search matches all including enable).

Edit: After looking in the log, the crash occurs during handling of the advancement armor_statues:enable. The offending data pack is attached here: armor statues v2.8.1.zip

The crash most likely occurs here: https://github.com/gbl/AdvancementInfo/blob/e24a027f7daab08274328de70c46883259119e7b/src/main/java/de/guntram/mcmod/advancementinfo/AdvancementInfo.java#L123

Crash reports: crash-2021-12-04_23.21.41-client.txt crash-2021-12-04_23.24.54-client.txt

gbl commented 2 years ago

It doesn't do that for me .. but I don't have armor statues enabled. It looks like that data pack adds an advancement, but doesn't give the advancement an tab to be shown in, which is why there is no tab so the mod crashes with "tab is null".

I just inserted an extra check in that case, with some logging output. Could you check the prerelease here to check if it works for you, please?

James103 commented 2 years ago

Sorry for the delay. I just tried the same thing in AdvancementInfo 1.18-fabric0.43.1-1.3 and got effectively the same crash. Crash log: crash-2021-12-18_19.27.20-client.txt

gbl commented 2 years ago

That's why I asked if you could test it, before releasing the 1.17 version and creating a new 1.18 version which might have the same bug .. you'd need an 1.3.1 version, which I didn't make for 1.18 yet.

James103 commented 2 years ago

I just made a minimal 1.17.1 instance with your mod, Fabric loader, and Fabric API. When attempting to reproduce with the new version, I get the following log lines instead of a crash:

Mods:
  [✔️] advancementinfo-1.17.1-fabric0.36.1-1.3.1
  [✔️] fabric-api-0.44.0+1.17
...
[12:43:09] [Render thread/DEBUG]: - armor_statues:enable enable_as_trigger:  
[12:43:09] [Render thread/INFO]: no tab found for advancement armor_statues:enable title enable_as_trigger description