1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:57:24 +08:00

Ignore overlapping links instead of crashing

This commit is contained in:
Susko3 2023-11-30 22:59:02 +01:00
parent c395ae2460
commit 152c7e513e

View File

@ -12,6 +12,7 @@ using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Online; using osu.Game.Online;
using osu.Game.Users; using osu.Game.Users;
@ -47,9 +48,16 @@ namespace osu.Game.Graphics.Containers
foreach (var link in links) foreach (var link in links)
{ {
string displayText = text.Substring(link.Index, link.Length);
if (previousLinkEnd > link.Index)
{
Logger.Log($@"Link ""{link.Url}"" with text ""{displayText}"" overlaps previous link, ignoring.");
continue;
}
AddText(text[previousLinkEnd..link.Index]); AddText(text[previousLinkEnd..link.Index]);
string displayText = text.Substring(link.Index, link.Length);
object linkArgument = link.Argument; object linkArgument = link.Argument;
string tooltip = displayText == link.Url ? null : link.Url; string tooltip = displayText == link.Url ? null : link.Url;