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

Fix nullref when opening files or URIs on startup on Android #31492

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

Susko3
Copy link
Member

@Susko3 Susko3 commented Jan 13, 2025

I think this regressed with SDL3, as CreateGame() is called later in the startup process compared to osutk. This will cause the private OsuGameAndroid game = null!; to be null. But we promised it won't be, so it's a nullref when the intent handling code tries to call game.Import().

To fix this, OsuGameAndroid is constructed immediately. And CreateGame() will just return that existing game. I also added a guard against calling CreateGame() twice. Calling it twice will likely crash somewhere deep in framework code, this just makes the failure point obvious.

Also fixes some nullrefs in intent handling, unrelated to the above issues.

Could happen if we get a malformed intent without data
@Susko3 Susko3 added platform/android area:import dealing with importing of data from stable or file formats labels Jan 13, 2025
@peppy peppy requested a review from smoogipoo January 13, 2025 06:00
@peppy
Copy link
Member

peppy commented Jan 13, 2025

Not sure we want to be doing this here, rather than a potential change to how things are handled framework side. I think smoogi has better understanding of expectations here.

@smoogipoo smoogipoo merged commit d81735d into ppy:master Jan 14, 2025
10 checks passed
@Susko3 Susko3 deleted the fix-nullref branch January 14, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:import dealing with importing of data from stable or file formats platform/android size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazer on android doesnt detect any file opened with "Share/Open with"
3 participants