Skip to content

Commit

Permalink
Ignore statistics update subscriptions with invalid score ID
Browse files Browse the repository at this point in the history
If score submission fails, the score will not receive a correct online
ID from web, but will still be passed on to the solo statistics watcher
on the results screen. This could lead to the watcher subscribing to
changes with score ID equal to the default of -1. If this happened more
than once, that would cause a crash due to duplicate keys in the
`callbacks` dictionary.

Closes #21837.
  • Loading branch information
bdach committed Dec 28, 2022
1 parent e9d32fc commit a0a26b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion osu.Game/Online/Solo/SoloStatisticsWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void RegisterForStatisticsUpdateAfter(ScoreInfo score, Action<SoloStatist
if (!api.IsLoggedIn)
return;

if (!score.Ruleset.IsLegacyRuleset())
if (!score.Ruleset.IsLegacyRuleset() || score.OnlineID <= 0)
return;

var callback = new StatisticsUpdateCallback(score, onUpdateReady);
Expand Down

0 comments on commit a0a26b1

Please sign in to comment.