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 content type values being null after deserializing #1651

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

felipeerias
Copy link
Collaborator

When we restore the window state from a JSON file, the content type field may be null if the GSON library was not able to map it to one of the enum values.

#1644 changed the type of the WindowState.panelType field from integer to enum. This meant that the serialized values did not match the new type, causing the restored field to unexpectedly become NULL. This caused a crash.

The solution is to change the name of the field to WindowState.contentType so it will not cause a clash when serializing and deserializing. Additionally, this PR adds checks to ensure that the restored value is not NULL.

Fixes #1648

When we restore the window state from a JSON file, the content type
field may be null if the GSON library was not able to map it to one
of the enum values.

#1644 changed the type of the
WindowState.panelType field from integer to enum. This meant that
the serialized values did not match the new type, causing the
restored field to unexpectedly become NULL. This caused a crash.

The solution is to change the name of the field to
WindowState.contentType so it will not cause a clash when serializing
and deserializing. Additionally, this PR adds checks to ensure that
the restored value is not NULL.

Fixes #1648
Copy link
Member

@svillar svillar left a comment

Choose a reason for hiding this comment

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

Thanks

@svillar svillar merged commit 91873b5 into main Nov 29, 2024
22 checks passed
@svillar svillar deleted the felipeerias/serializeContentType branch November 29, 2024 11:20
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 at statup
2 participants