mirror of
https://github.com/ppy/osu
synced 2025-01-14 01:51:04 +00:00
Cache ruleset + fix possible nullrefs
This commit is contained in:
parent
7ac08620b8
commit
d88bfa2080
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Users;
|
||||
@ -48,6 +49,8 @@ namespace osu.Game.Online.API
|
||||
|
||||
public ScoreInfo CreateScoreInfo(PlaylistItem playlistItem)
|
||||
{
|
||||
var rulesetInstance = playlistItem.Ruleset.Value.CreateInstance();
|
||||
|
||||
var scoreInfo = new ScoreInfo
|
||||
{
|
||||
OnlineScoreID = ID,
|
||||
@ -62,7 +65,7 @@ namespace osu.Game.Online.API
|
||||
Date = EndedAt,
|
||||
Hash = string.Empty, // todo: temporary?
|
||||
Rank = Rank,
|
||||
Mods = Mods.Select(m => m.ToMod(playlistItem.Ruleset.Value.CreateInstance())).ToArray()
|
||||
Mods = Mods?.Select(m => m.ToMod(rulesetInstance)).ToArray() ?? Array.Empty<Mod>()
|
||||
};
|
||||
|
||||
return scoreInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user