mirror of https://github.com/ppy/osu
Silence exception and provide more log output when import fails due to empty `.osu` files
This commit is contained in:
parent
e82d948acc
commit
d38defada4
|
@ -177,8 +177,17 @@ protected override void UndeleteForReuse(BeatmapSetInfo existing)
|
|||
}
|
||||
|
||||
Beatmap beatmap;
|
||||
|
||||
using (var stream = new LineBufferedReader(reader.GetStream(mapName)))
|
||||
{
|
||||
if (stream.PeekLine() == null)
|
||||
{
|
||||
Logger.Log($"No content found in first .osu file of beatmap archive ({reader.Name} / {mapName})", LoggingTarget.Database);
|
||||
return null;
|
||||
}
|
||||
|
||||
beatmap = Decoder.GetDecoder<Beatmap>(stream).Decode(stream);
|
||||
}
|
||||
|
||||
return new BeatmapSetInfo
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ public static Decoder<T> GetDecoder<T>(LineBufferedReader stream)
|
|||
}
|
||||
|
||||
if (line == null)
|
||||
throw new IOException("Unknown file format (null)");
|
||||
throw new IOException("Unknown file format (no content)");
|
||||
|
||||
var decoder = typedDecoders.Where(d => line.StartsWith(d.Key, StringComparison.InvariantCulture)).Select(d => d.Value).FirstOrDefault();
|
||||
|
||||
|
|
Loading…
Reference in New Issue