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 errors related to scenarios #688

Merged
merged 2 commits into from
Oct 27, 2021

Conversation

lmoureaux
Copy link
Contributor

Closes #683.

The client was crashing when loading a scenario, exiting the game, and trying
to go back to the scenario page. The reason was that the list of scenarios is
reloaded in this case, and the first time the loading code does is to clear the
QListWidget holding the list of scenarios. This propagated to the "selection
changed" callback that was trying to access the (nonexistant) first selected
item, resulting in a crash.

The fix is to check that there's something selected before trying to use it.

See longturn#683.
I/O (or decompression) errors that occurred while reading spec files resulted
in an infinite loop. This was the case e.g. when trying to read an empty file
with ".gz" extension -- for instance, a failed save.

Make sure that any error is properly handled and terminates reading the file.
This makes the code a bit awful because the QIODevice error reporting API is
just terrible.
@jwrober
Copy link
Collaborator

jwrober commented Oct 17, 2021

I can confirm that this patch fixes the crash.

@lmoureaux lmoureaux merged commit ceb24cd into longturn:master Oct 27, 2021
@lmoureaux lmoureaux deleted the bugfix/scenarios branch October 27, 2021 20:38
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

Successfully merging this pull request may close these issues.

Crash when loading scenario (after previously quitting scenario)
2 participants