Ignore statistics update subscriptions with invalid score ID

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.
This commit is contained in:
Bartłomiej Dach
2022-12-28 07:37:52 +01:00
parent e9d32fca18
commit a0a26b1e8c

View File

@ -51,7 +51,7 @@ namespace osu.Game.Online.Solo
if (!api.IsLoggedIn)
return;
if (!score.Ruleset.IsLegacyRuleset())
if (!score.Ruleset.IsLegacyRuleset() || score.OnlineID <= 0)
return;
var callback = new StatisticsUpdateCallback(score, onUpdateReady);