Merge pull request #2276 from peppy/ignore-unknown-sections

Don't hard-crash when an unknown section is encountered in a legacy file
This commit is contained in:
Dean Herbert 2018-03-22 14:56:28 +09:00 committed by GitHub
commit 977e73bba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Logging;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Formats
@ -31,7 +32,11 @@ namespace osu.Game.Beatmaps.Formats
if (line.StartsWith(@"[") && line.EndsWith(@"]"))
{
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
throw new InvalidDataException($@"Unknown osu section {line}");
{
Logger.Log($"Unknown section \"{line}\" in {beatmap}");
section = Section.None;
}
continue;
}