1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:43:04 +08:00

Fix GroupBadge crashing on null group colour

This commit is contained in:
StanR 2023-01-14 02:23:08 +03:00
parent 7782bfb80b
commit 660bf748d5
2 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,7 @@ namespace osu.Game.Online.API.Requests.Responses
public class APIUserGroup public class APIUserGroup
{ {
[JsonProperty(@"colour")] [JsonProperty(@"colour")]
public string Colour { get; set; } = null!; public string? Colour { get; set; }
[JsonProperty(@"has_listing")] [JsonProperty(@"has_listing")]
public bool HasListings { get; set; } public bool HasListings { get; set; }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
@ -62,7 +63,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new OsuSpriteText new OsuSpriteText
{ {
Text = group.ShortName, Text = group.ShortName,
Colour = Color4Extensions.FromHex(group.Colour), Colour = Color4Extensions.FromHex(group.Colour ?? Colour4.White.ToHex()),
Shadow = false, Shadow = false,
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true) Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true)
} }