You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ScreenPrompt.getWidgets() throws NPE when children() is called before the prompt is initialized #3965
When the donation prompt is pending, VideoSettingsScreen creates the ScreenPrompt early, but the prompt only builds its buttons in ScreenPrompt#init(), and VideoSettingsScreen#init() calls that after rebuild(). In that window children() already returns prompt.getWidgets(), which is List.of(this.actionButton, this.closeButton) with both still null, so it throws an NPE.
Vanilla never calls children() there so nothing breaks on its own, but children() is public API and any mod that looks at it during clearWidgets() crashes the game when opening Video Settings. I found it with CC: Graphics, which does exactly that (also reported at sashafiesta/CC-Graphics#3).
In config/sodium-options.json set has_seen_donation_prompt to false, and set t in config/sodium-fingerprint.json to something small (or wait three days)
Start the game and open Video Settings -> crash
Trace (trimmed):
Caused by: java.lang.NullPointerException
at java.util.List.of(List.java:954)
at net.caffeinemc.mods.sodium.client.gui.prompt.ScreenPrompt.getWidgets(ScreenPrompt.java:109)
at net.caffeinemc.mods.sodium.client.gui.VideoSettingsScreen.children(VideoSettingsScreen.java:516)
at net.minecraft.client.gui.screens.Screen.ccgraphics$closeGraphicsWidgets(Screen.java:756)
at net.minecraft.client.gui.screens.Screen.clearWidgets(Screen.java)
at net.caffeinemc.mods.sodium.client.gui.VideoSettingsScreen.rebuild(VideoSettingsScreen.java:172)
at net.caffeinemc.mods.sodium.client.gui.VideoSettingsScreen.init(VideoSettingsScreen.java:143)
Easy fixes: call prompt.init() before rebuild(), or make getWidgets() skip buttons that haven't been created yet. I worked around it locally with the second. Same code is on dev (ScreenPrompt.java:101). Happy to PR if you want.
Activity