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 MekHQ #3986: MHQ wont save, sometimes #5338

Merged

Conversation

AaronGullickson
Copy link
Member

This should fix MegaMek/mekhq#3986. The issue is that Entity.c3UUID can be null in BotForces, but that is never checked in EntityListFile. The original XML writer in MHQ for BotForces avoided this problem by ... not checking C3 at all. Ultimately, we need to correct all of this by consolidating XML writers, but that is a bigger project.

I fixed it simply by checking for null status before writing. I looked for other cases where we might be writing a null object in the same method and I could not find any. I tested it on the campaign file by generating random opponents when advancing day and saving. I was able to do it in 20 cases without problem including many cases where I know I had a C3 entity.

Co-authored-by: kuronekochomusuke <116095479+kuronekochomusuke@users.noreply.github.com>
@AaronGullickson AaronGullickson merged commit 54bc248 into MegaMek:master Apr 10, 2024
4 checks passed
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.

MHQ wont save, sometimes
2 participants