Skip to content

Commit

Permalink
Add guard against fetching statistics for non-legacy rulesets
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Nov 25, 2024
1 parent 53b3906 commit 0a3f3c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions osu.Game/Online/LocalUserStatisticsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ private void initialiseStatistics()

public void RefetchStatistics(RulesetInfo ruleset, Action<UserStatisticsUpdate>? callback = null)
{
if (!ruleset.IsLegacyRuleset())
throw new InvalidOperationException($@"Retrieving statistics is not supported for ruleset {ruleset.ShortName}");

var request = new GetUserRequest(api.LocalUser.Value.Id, ruleset);
request.Success += u => UpdateStatistics(u.Statistics, ruleset, callback);
api.Queue(request);
Expand Down

0 comments on commit 0a3f3c3

Please sign in to comment.