mirror of https://github.com/ppy/osu
Fix potential crash when opening changelog overlay if entry has no URL
This commit is contained in:
parent
31225066a1
commit
58c1ea0321
|
@ -4,6 +4,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
@ -93,7 +94,7 @@ private Drawable createTitle()
|
||||||
t.Colour = entryColour;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(entry.Repository))
|
if (!string.IsNullOrEmpty(entry.Repository) && !string.IsNullOrEmpty(entry.GithubUrl))
|
||||||
addRepositoryReference(title, entryColour);
|
addRepositoryReference(title, entryColour);
|
||||||
|
|
||||||
if (entry.GithubUser != null)
|
if (entry.GithubUser != null)
|
||||||
|
@ -104,17 +105,22 @@ private Drawable createTitle()
|
||||||
|
|
||||||
private void addRepositoryReference(LinkFlowContainer title, Color4 entryColour)
|
private void addRepositoryReference(LinkFlowContainer title, Color4 entryColour)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(!string.IsNullOrEmpty(entry.Repository));
|
||||||
|
Debug.Assert(!string.IsNullOrEmpty(entry.GithubUrl));
|
||||||
|
|
||||||
title.AddText(" (", t =>
|
title.AddText(" (", t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
t.Colour = entryColour;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl,
|
title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl,
|
||||||
t =>
|
t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
t.Colour = entryColour;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
title.AddText(")", t =>
|
title.AddText(")", t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
|
|
Loading…
Reference in New Issue