1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Merge pull request #2427 from peppy/fix-badge-container

Fix BadgeContainer being unable to handle null badges
This commit is contained in:
Dean Herbert 2018-04-23 19:38:17 +09:00 committed by GitHub
commit 2952ba2433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,22 +92,18 @@ namespace osu.Game.Overlays.Profile.Header
public void ShowBadges(Badge[] badges)
{
switch (badges.Length)
if (badges == null || badges.Length == 0)
{
case 0:
Hide();
return;
case 1:
badgeCountText.Hide();
break;
default:
badgeCountText.Show();
badgeCountText.Text = $"{badges.Length} badges";
break;
Hide();
return;
}
Show();
badgeCount = badges.Length;
badgeCountText.FadeTo(badgeCount > 1 ? 1 : 0);
badgeCountText.Text = $"{badges.Length} badges";
Show();
visibleBadge = 0;
badgeFlowContainer.Clear();