From 29c2a2979852f00ddafbf1d58560a681c2a2ea78 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 9 Oct 2017 18:47:12 +0900 Subject: [PATCH] Fix trimming too early in OsuLegacyDecoder crashing storyboards --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 353959582b..a70faf5be6 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -611,9 +611,9 @@ namespace osu.Game.Beatmaps.Formats CommandTimelineGroup timelineGroup = null; string line; - while ((line = stream.ReadLine()?.Trim()) != null) + while ((line = stream.ReadLine()) != null) { - if (string.IsNullOrEmpty(line)) + if (string.IsNullOrEmpty(line.Trim())) continue; if (line.StartsWith("//")) @@ -679,10 +679,12 @@ namespace osu.Game.Beatmaps.Formats private KeyValuePair splitKeyVal(string line, char separator) { + var split = line.Trim().Split(separator); + return new KeyValuePair ( - line.Remove(line.IndexOf(separator)).Trim(), - line.Substring(line.IndexOf(separator) + 1).Trim() + split[0].Trim(), + split.Length > 1 ? split[1].Trim() : string.Empty ); }