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 NPE with loaded save games from past versions. #11783

Merged
merged 2 commits into from
Jul 16, 2023

Conversation

asvitkine
Copy link
Contributor

Change Summary & Additional Notes

The issue is that old saved games may save references to the GamePlayer on various objects, including pending battles.

Since 2.6 has an invariant that all GamePlayer objects have a non-null getData(), which was not true in 2.5 and earlier, we need to update these after loading the game. In particular, we need to fix up all references to the null player with the instance from the game data.

This was already being done for units and territories via GameData::fixUpNullPlayers(). This adds it also for pending battles.

Fixes: #11151

Release Note

The issue is that old saved games may save references to the GamePlayer on various objects, including pending battles.

Since 2.6 has an invariant that all GamePlayer objects have a non-null getData(), which was not true in 2.5 and earlier, we need to update these after loading the game. In particular, we need to fix up all references to the null player with the instance from the game data.

This was already being done for units and territories via GameData::fixUpNullPlayers(). This adds it also for pending battles.
@asvitkine asvitkine merged commit c4f9314 into triplea-game:master Jul 16, 2023
1 check 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.

2.6+14178: UnifiedInvocationHandler#invoke:57 - java.lang.NullPointerException
1 participant