mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Fix potential mod nullref in APIUserScoreAggregate
's CreateScoreInfo
implementation
This commit is contained in:
parent
b2d09b7b10
commit
4c79145c11
@ -1,7 +1,9 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
@ -42,7 +44,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
PP = PP,
|
||||
TotalScore = TotalScore,
|
||||
User = User,
|
||||
Position = Position
|
||||
Position = Position,
|
||||
Mods = Array.Empty<Mod>()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -186,14 +186,12 @@ namespace osu.Game.Scoring
|
||||
{
|
||||
get
|
||||
{
|
||||
var rulesetInstance = Ruleset.CreateInstance();
|
||||
|
||||
Mod[] scoreMods = Array.Empty<Mod>();
|
||||
|
||||
if (mods != null)
|
||||
scoreMods = mods;
|
||||
else if (localAPIMods != null)
|
||||
scoreMods = APIMods.Select(m => m.ToMod(rulesetInstance)).ToArray();
|
||||
scoreMods = APIMods.Select(m => m.ToMod(Ruleset.CreateInstance())).ToArray();
|
||||
|
||||
return scoreMods;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user