1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 21:23:04 +08:00

Fix hard crash in editor on legacy modes without encoder implementation

This commit is contained in:
Dean Herbert 2020-04-18 12:57:09 +09:00
parent 149efec985
commit 61e3491e60

View File

@ -82,12 +82,19 @@ namespace osu.Game.Screens.Edit
if (savedStates.Count > MAX_SAVED_STATES)
savedStates.RemoveAt(0);
using (var stream = new MemoryStream())
try
{
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
new LegacyBeatmapEncoder(editorBeatmap).Encode(sw);
using (var stream = new MemoryStream())
{
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
new LegacyBeatmapEncoder(editorBeatmap).Encode(sw);
savedStates.Add(stream.ToArray());
savedStates.Add(stream.ToArray());
}
}
catch (NotImplementedException)
{
// some rulesets don't have encoder implementations yet.
}
currentState = savedStates.Count - 1;