From a8cf7ff93a935138e2d3fb6118bbef7646c060ae Mon Sep 17 00:00:00 2001 From: MillhioreF Date: Wed, 9 Aug 2017 23:27:13 -0500 Subject: [PATCH] Add a better error message for corrupt maps with no .osu files --- osu.Game/Beatmaps/BeatmapManager.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index bbb6c975d0..61cd2f0a2b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -307,6 +307,16 @@ namespace osu.Game.Beatmaps /// The imported beatmap, or an existing instance if it is already present. private BeatmapSetInfo importToStorage(ArchiveReader reader) { + // let's make sure there are actually .osu files to import. + try + { + string mapName = reader.Filenames.First(f => f.EndsWith(".osu")); + } + catch + { + throw new InvalidOperationException("No beatmap files found in the map folder."); + } + // for now, concatenate all .osu files in the set to create a unique hash. MemoryStream hashable = new MemoryStream(); foreach (string file in reader.Filenames.Where(f => f.EndsWith(".osu")))