mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Merge pull request #10730 from peppy/fix-patcher-no-object-crash
Fix legacy patcher crash on no objects present
This commit is contained in:
commit
a2877fb00a
@ -37,6 +37,12 @@ namespace osu.Game.Tests.Editing
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPatchNoObjectChanges()
|
||||||
|
{
|
||||||
|
runTest(new OsuBeatmap());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAddHitObject()
|
public void TestAddHitObject()
|
||||||
{
|
{
|
||||||
|
@ -235,11 +235,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
private void handleHitObjects(TextWriter writer)
|
private void handleHitObjects(TextWriter writer)
|
||||||
{
|
{
|
||||||
|
writer.WriteLine("[HitObjects]");
|
||||||
|
|
||||||
if (beatmap.HitObjects.Count == 0)
|
if (beatmap.HitObjects.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
writer.WriteLine("[HitObjects]");
|
|
||||||
|
|
||||||
foreach (var h in beatmap.HitObjects)
|
foreach (var h in beatmap.HitObjects)
|
||||||
handleHitObject(writer, h);
|
handleHitObject(writer, h);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiffPlex;
|
using DiffPlex;
|
||||||
@ -35,6 +36,9 @@ namespace osu.Game.Screens.Edit
|
|||||||
int oldHitObjectsIndex = Array.IndexOf(result.PiecesOld, "[HitObjects]");
|
int oldHitObjectsIndex = Array.IndexOf(result.PiecesOld, "[HitObjects]");
|
||||||
int newHitObjectsIndex = Array.IndexOf(result.PiecesNew, "[HitObjects]");
|
int newHitObjectsIndex = Array.IndexOf(result.PiecesNew, "[HitObjects]");
|
||||||
|
|
||||||
|
Debug.Assert(oldHitObjectsIndex >= 0);
|
||||||
|
Debug.Assert(newHitObjectsIndex >= 0);
|
||||||
|
|
||||||
var toRemove = new List<int>();
|
var toRemove = new List<int>();
|
||||||
var toAdd = new List<int>();
|
var toAdd = new List<int>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user