mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:52:55 +08:00
Merge pull request #16622 from peppy/fix-results-score-switch-crash
Fix crash at results screen when viewing another score panel after playing
This commit is contained in:
commit
4a51bab9ac
@ -26,12 +26,16 @@ namespace osu.Game.Tests.NonVisual
|
||||
|
||||
score.Statistics[HitResult.Good]++;
|
||||
score.Rank = ScoreRank.X;
|
||||
score.RealmUser.Username = "test";
|
||||
|
||||
Assert.That(scoreCopy.Statistics[HitResult.Good], Is.EqualTo(10));
|
||||
Assert.That(score.Statistics[HitResult.Good], Is.EqualTo(11));
|
||||
|
||||
Assert.That(scoreCopy.Rank, Is.EqualTo(ScoreRank.B));
|
||||
Assert.That(score.Rank, Is.EqualTo(ScoreRank.X));
|
||||
|
||||
Assert.That(scoreCopy.RealmUser.Username, Is.Empty);
|
||||
Assert.That(score.RealmUser.Username, Is.EqualTo("test"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Models
|
||||
{
|
||||
public int OnlineID { get; set; } = 1;
|
||||
|
||||
public string Username { get; set; }
|
||||
public string Username { get; set; } = string.Empty;
|
||||
|
||||
public bool IsBot => false;
|
||||
|
||||
|
@ -133,6 +133,11 @@ namespace osu.Game.Scoring
|
||||
var clone = (ScoreInfo)this.Detach().MemberwiseClone();
|
||||
|
||||
clone.Statistics = new Dictionary<HitResult, int>(clone.Statistics);
|
||||
clone.RealmUser = new RealmUser
|
||||
{
|
||||
OnlineID = RealmUser.OnlineID,
|
||||
Username = RealmUser.Username,
|
||||
};
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user