Rewrite updateDisplay logic to not fail on some cases

This commit is contained in:
Dean Herbert 2019-04-03 18:29:46 +09:00
parent 5c3c08566f
commit a15a9bd03a
1 changed files with 6 additions and 14 deletions

View File

@ -121,25 +121,17 @@ public BeatmapInfo Beatmap
private void updateDisplay()
{
scoreTable.Scores = new List<ScoreInfo>();
loading = false;
var scoreCount = scores?.Count ?? 0;
scoreTable.Scores = scores?.Count > 1 ? scores : new List<ScoreInfo>();
if (scoreCount == 0)
if (scores.Any())
{
topScore.Hide();
return;
topScore.Score = scores.FirstOrDefault();
topScore.Show();
}
topScore.Score = scores.FirstOrDefault();
topScore.Show();
if (scoreCount < 2)
return;
scoreTable.Scores = scores;
else
topScore.Hide();
}
protected override void Dispose(bool isDisposing)