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(SelectionScreen): be more robust in the face of save files with incomplete manifests #5008

Merged
merged 6 commits into from
May 8, 2022

Conversation

keturn
Copy link
Member

@keturn keturn commented May 7, 2022

Fixes #4912

Notes for Reviewers

The mainWorldDisplayName method I factored out to GameManifest is very much a "view" type of method, given the way it returns error strings. I'd accept suggestions of other places to put it. Especially if that place had dependency injection support so the caller doesn't have to explicitly pass WorldGeneratorManager.

How to test

Edit the manifest.json of one of your save files so the worlds entry is the empty set: "worlds": {},

Start Terasology and go to the game loading screen, make sure that doesn't crash.
Hit the "Details" button, make sure that doesn't crash.

If you proceed to try to actually load the game, that will crash (we can only do so much with a broken save!). Hopefully with a relevant error message.

@github-actions github-actions bot added the Type: Bug Issues reporting and PRs fixing problems label May 7, 2022
@keturn
Copy link
Member Author

keturn commented May 7, 2022

I broke it? I thought I had style checks turned on locally. Guess I missed something!

@jdrueckert
Copy link
Member

Removing the worlds from a save's manifest.json successfully reproduced the crash on current develop.
With this PR checked out, the game does neither crash when opening the selection screen nor when opening the save details.
On loading the game it crashes as expected with the error message "Game manifest does not contain a MAIN_WORLD" which I think describes the problem pretty well 👍

image

Copy link
Member

@jdrueckert jdrueckert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the top of my head, I don't have a good idea for a suitable alternative place for mainWorldDisplayName. If you want to wait for other reviewers' ideas, feel free to do so.

If not, from my side this is good to be merged as it fixes the underlying issue 👍

@keturn keturn merged commit 685a895 into develop May 8, 2022
@keturn keturn deleted the fix/4912-robustSelectionScreen branch May 8, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Harden against showing corrupted save games on the selection screen
2 participants