Repository navigation
Fix crash after the game reaches the menu (null versionInfo) - #7
Merged
Merged
Conversation
getVersionInfo() returns null whenever a version's <name>.json is absent or fails to parse, but the version directory itself still exists on disk. Three call sites dereferenced it with !!: - LauncherElements.TryLaunch read minecraftVersion before doing anything else. - GameHandler.execute read it twice: once for the pre-1.13 key fixups and once for loadLanguage(). This one runs as the game screen opens, which is why the crash shows up after the game has already started loading. All three now degrade instead of throwing. The launch path checks versionInfo up front and reports a new LaunchGameOperation.InvalidVersion, which sends the user to version management with an explanation rather than a crash screen; the handler skips the two version-dependent fixups when the version number is unknown. Neither fixup is needed to start the game. Also add AGENTS.md with build notes and the launch pipeline layout. Co-authored-by: openhands <openhands@all-hands.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
The launcher shows its crash screen after the game reaches the menu. That screen is
ErrorActivity, reached either from the JVM exit callback or from the app's uncaughtexception handler — so something really is dying, not just failing to render.
Version.getVersionInfo()returnsVersionInfo?. It is null whenever the version's<name>.jsonis missing or fails to parse, while the version directory itself still existson disk. Three call sites dereferenced it with
!!:LauncherElements.TryLaunchminecraftVersionbefore doing anything elseGameHandler.execute(pre-1.13 key fixups)GameHandler.execute(loadLanguage)The
GameHandlerones fire as the game screen is being set up, which matches the reportedtiming: the game gets far enough to look like it is starting, then dies.
The fix
All three now degrade instead of throwing.
versionInfoup front and emits a newLaunchGameOperation.InvalidVersion, which sends the user to version management with anexplanation. Previously this was an unhandled NPE.
GameHandlerskips the two version-dependent fixups when the version number is unknown.Neither is needed to start the game: one is a pre-1.13 keybind workaround, the other picks
a language file.
The new string is added to
values/,values-zh-rCN/, andvalues-zh-rTW/.Also included
AGENTS.md— build notes, the launch pipeline layout, and thegetVersionInfo()nullsemantics so this class of bug is easier to avoid next time.
Verification
I could not compile or run this: the dev container has no JDK and no Android SDK
(
javais not installed), and there is no attached device. The changes were verified byreading:
LaunchGameOperationis a sealed interface whosewheninLauncherElements.ktis exhaustive, so the new case had to be handled and is; no remaining
getVersionInfo()!!exists in the launch or game-screen paths.
Please build and run this against the version that was crashing to confirm.
Scope note
This is a null-safety fix for a real crash, and it is separate from the earlier
cracked/offline-account work. If your crash happens with a version whose JSON is intact,
this will not be the cause, and I would need the crash log from
ErrorActivityto gofurther.
By ChimeraTeam