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 NullReferenceException on high scores page #18

Merged
merged 2 commits into from
Mar 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Shared/Systems/GameScoresPersistence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
private bool saving = false;
private bool loading = false;
private GameScores m_loadedState = null;
private GameScores m_loadedState = new GameScores();


public void SaveScores(GameScores gameScores)
Expand All @@ -16,7 +16,7 @@
if (!saving)
{
saving = true;
finalizeSaveGameScoresAsync(gameScores);

Check warning on line 19 in src/Shared/Systems/GameScoresPersistence.cs

View workflow job for this annotation

GitHub Actions / buildProject

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
}
}

Expand Down Expand Up @@ -89,7 +89,7 @@
if (fs != null)
{
DataContractJsonSerializer mySerializer = new DataContractJsonSerializer(typeof(GameScores));
m_loadedState = (GameScores)mySerializer.ReadObject(fs);

Check warning on line 92 in src/Shared/Systems/GameScoresPersistence.cs

View workflow job for this annotation

GitHub Actions / buildProject

Converting null literal or possible null value to non-nullable type.

Check warning on line 92 in src/Shared/Systems/GameScoresPersistence.cs

View workflow job for this annotation

GitHub Actions / buildProject

Possible null reference assignment.
}
}
}
Expand Down
Loading