1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:03:21 +08:00

Fix assertion failures

This commit is contained in:
Dan Balasescu 2022-06-13 16:56:08 +09:00
parent 285e5abb41
commit a8286bdf04

View File

@ -82,14 +82,18 @@ namespace osu.Game.Screens.Edit
// Find the index of [HitObject] sections. Lines changed prior to this index are ignored.
int oldSectionStartIndex = Array.IndexOf(result.PiecesOld, $"[{section}]");
int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith('['));
if (oldSectionStartIndex == -1)
return;
int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith('['));
if (oldSectionEndIndex == -1)
oldSectionEndIndex = result.PiecesOld.Length;
int newSectionStartIndex = Array.IndexOf(result.PiecesNew, $"[{section}]");
int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith('['));
if (newSectionStartIndex == -1)
return;
int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith('['));
if (newSectionEndIndex == -1)
newSectionEndIndex = result.PiecesNew.Length;