1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:02:55 +08:00

Fixed a bug where links would be out of order in their List which would cause the game to crash

This commit is contained in:
FreezyLemon 2017-12-07 10:31:44 +01:00
parent ec8b5c2465
commit 1b971c01e6

View File

@ -137,6 +137,9 @@ namespace osu.Game.Online.Chat
var formatted = inputMessage;
formatted.Content = result.Text;
// Sometimes, regex matches are not in order
result.Links.Sort();
formatted.Links = result.Links;
return formatted;
}
@ -153,7 +156,7 @@ namespace osu.Game.Online.Chat
}
}
public class Link
public class Link : IComparable<Link>
{
public string Url;
public int Index;
@ -165,6 +168,8 @@ namespace osu.Game.Online.Chat
Index = startIndex;
Length = length;
}
public int CompareTo(Link otherLink) => Index > otherLink.Index ? 1 : -1;
}
}
}