Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BadgeContainer being unable to handle null badges #2427

Merged
merged 2 commits into from Apr 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 8 additions & 12 deletions osu.Game/Overlays/Profile/Header/BadgeContainer.cs
Expand Up @@ -92,22 +92,18 @@ private void rotateBadges()

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();
Expand Down