Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MainMenuBar causes NullPointerException when clicking on free space #177

Open
KrykiZZ opened this issue Mar 15, 2022 · 1 comment
Open

Comments

@KrykiZZ
Copy link

KrykiZZ commented Mar 15, 2022

Workspace used:

  • FabricMC Kotlin template: natanfudge / fabric-example-mod-kotlin
  • Minecraft 1.18.1
  • com.github.kotlin-graphics.imgui:core:v1.79
  • com.github.kotlin-graphics.imgui:gl:v1.79
  • com.github.kotlin-graphics.imgui:glfw:v1.79
    With excluded org.lwjgl

After opening menu from MainMenuBar and clicking on empty space of the screen - menu disappears and rendering starts to spam following exception

java.lang.NullPointerException
	at imgui.internal.api.PopupsModalsTooltips$DefaultImpls.closePopupsOverWindow(PopupsModalsTooltips.kt:174)
	at imgui.ImGui.closePopupsOverWindow(imgui.kt:156)
	at imgui.api.main$DefaultImpls.newFrame(main.kt:219)
	at imgui.ImGui.newFrame(imgui.kt:156)
	at dev.kirakun.monke.clickgui.screens.ImguiScreen.render(ImguiScreen.kt:119)
	at net.minecraft.client.render.GameRenderer.render(GameRenderer.java:875)
	at net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1117)
	at net.minecraft.client.MinecraftClient.run(MinecraftClient.java:733)
	at net.minecraft.client.main.Main.main(Main.java:238)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:608)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

Code:

implGl3?.newFrame();
implGlfw?.newFrame();
imgui.newFrame();

if (imgui.beginMainMenuBar())
{
    if (imgui.beginMenu("Debug"))
    {
        imgui.checkbox("Reload ICraftable", ActionExecutor.instance::craftable);
        imgui.checkbox("Reload ISmeltable", ActionExecutor.instance::smeltable);
        imgui.checkbox("Reload everything", ActionExecutor.instance::everything);
        imgui.checkbox("Reload everything (lazy)", ActionExecutor.instance::everythingLazy);
        imgui.endMenu()
    }
    imgui.endMainMenuBar()
}

imgui.render();
Objects.requireNonNull(imgui.drawData)?.let { implGl3?.renderDrawData(it) };

Recording:
rec

@KrykiZZ
Copy link
Author

KrykiZZ commented Mar 15, 2022

Found additional information - before the exception in STDOUT writes [00029] OpenPopupEx(0x181EE2BD).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant