diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 61cd2f0a2b..4b063adde0 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -307,10 +307,11 @@ namespace osu.Game.Beatmaps /// The imported beatmap, or an existing instance if it is already present. private BeatmapSetInfo importToStorage(ArchiveReader reader) { + string mapName; // let's make sure there are actually .osu files to import. try { - string mapName = reader.Filenames.First(f => f.EndsWith(".osu")); + mapName = reader.Filenames.First(f => f.EndsWith(".osu")); } catch { @@ -349,7 +350,7 @@ namespace osu.Game.Beatmaps BeatmapMetadata metadata; - using (var stream = new StreamReader(reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))) + using (var stream = new StreamReader(reader.GetStream(mapName))) metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; beatmapSet = new BeatmapSetInfo