mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Make country code parsing resilient to invalid cases
This commit is contained in:
parent
be5a413753
commit
d700040a0d
@ -195,7 +195,7 @@ Line after image";
|
|||||||
AddStep("Add flag", () =>
|
AddStep("Add flag", () =>
|
||||||
{
|
{
|
||||||
markdownContainer.CurrentPath = @"https://dev.ppy.sh";
|
markdownContainer.CurrentPath = @"https://dev.ppy.sh";
|
||||||
markdownContainer.Text = "::{flag=\"AU\"}::";
|
markdownContainer.Text = "::{flag=\"AU\"}:: ::{flag=\"ZZ\"}::";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,11 @@ namespace osu.Game.Graphics.Containers.Markdown
|
|||||||
}
|
}
|
||||||
|
|
||||||
string flag = flagAttribute.Split('=').Last().Trim('"');
|
string flag = flagAttribute.Split('=').Last().Trim('"');
|
||||||
AddDrawable(new DrawableFlag(Enum.Parse<CountryCode>(flag)) { Size = new Vector2(20, 15) });
|
|
||||||
|
if (!Enum.TryParse<CountryCode>(flag, out var countryCode))
|
||||||
|
countryCode = CountryCode.Unknown;
|
||||||
|
|
||||||
|
AddDrawable(new DrawableFlag(countryCode) { Size = new Vector2(20, 15) });
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OsuMarkdownInlineCode : Container
|
private class OsuMarkdownInlineCode : Container
|
||||||
|
Loading…
x
Reference in New Issue
Block a user