1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 11:52:54 +08:00

Merge pull request #8525 from peppy/fix-modded-replay-import

Fix replay imports failing for certain mod combinations
This commit is contained in:
Dan Balasescu 2020-03-31 17:38:57 +09:00 committed by GitHub
commit 93a9994bcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,10 +28,11 @@ namespace osu.Game.Scoring.Legacy
{ {
var score = new Score var score = new Score
{ {
ScoreInfo = new ScoreInfo(),
Replay = new Replay() Replay = new Replay()
}; };
WorkingBeatmap workingBeatmap;
using (SerializationReader sr = new SerializationReader(stream)) using (SerializationReader sr = new SerializationReader(stream))
{ {
currentRuleset = GetRuleset(sr.ReadByte()); currentRuleset = GetRuleset(sr.ReadByte());
@ -41,7 +42,7 @@ namespace osu.Game.Scoring.Legacy
var version = sr.ReadInt32(); var version = sr.ReadInt32();
var workingBeatmap = GetBeatmap(sr.ReadString()); workingBeatmap = GetBeatmap(sr.ReadString());
if (workingBeatmap is DummyWorkingBeatmap) if (workingBeatmap is DummyWorkingBeatmap)
throw new BeatmapNotFoundException(); throw new BeatmapNotFoundException();
@ -113,6 +114,10 @@ namespace osu.Game.Scoring.Legacy
CalculateAccuracy(score.ScoreInfo); CalculateAccuracy(score.ScoreInfo);
// before returning for database import, we must restore the database-sourced BeatmapInfo.
// if not, the clone operation in GetPlayableBeatmap will cause a dereference and subsequent database exception.
score.ScoreInfo.Beatmap = workingBeatmap.BeatmapInfo;
return score; return score;
} }