mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00: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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests.Responses
|
namespace osu.Game.Online.API.Requests.Responses
|
||||||
@ -42,7 +44,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
PP = PP,
|
PP = PP,
|
||||||
TotalScore = TotalScore,
|
TotalScore = TotalScore,
|
||||||
User = User,
|
User = User,
|
||||||
Position = Position
|
Position = Position,
|
||||||
|
Mods = Array.Empty<Mod>()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,14 +186,12 @@ namespace osu.Game.Scoring
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var rulesetInstance = Ruleset.CreateInstance();
|
|
||||||
|
|
||||||
Mod[] scoreMods = Array.Empty<Mod>();
|
Mod[] scoreMods = Array.Empty<Mod>();
|
||||||
|
|
||||||
if (mods != null)
|
if (mods != null)
|
||||||
scoreMods = mods;
|
scoreMods = mods;
|
||||||
else if (localAPIMods != null)
|
else if (localAPIMods != null)
|
||||||
scoreMods = APIMods.Select(m => m.ToMod(rulesetInstance)).ToArray();
|
scoreMods = APIMods.Select(m => m.ToMod(Ruleset.CreateInstance())).ToArray();
|
||||||
|
|
||||||
return scoreMods;
|
return scoreMods;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user