1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 06:52:53 +08:00

Null online id on lookup failure

This commit is contained in:
Dean Herbert 2019-11-15 10:18:47 +09:00
parent fbf81207d4
commit 6d54846462

View File

@ -387,7 +387,7 @@ namespace osu.Game.Beatmaps
var req = new GetBeatmapRequest(beatmap); var req = new GetBeatmapRequest(beatmap);
req.Failure += e => { LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})"); }; req.Failure += fail;
try try
{ {
@ -399,16 +399,18 @@ namespace osu.Game.Beatmaps
beatmap.Status = res.Status; beatmap.Status = res.Status;
beatmap.BeatmapSet.Status = res.BeatmapSet.Status; beatmap.BeatmapSet.Status = res.BeatmapSet.Status;
beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID;
beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
// note that this check only needs to be here if two identical hashed beatmaps exist int he same import.
// probably fine to leave it for safety.
if (set.Beatmaps.All(b => b.OnlineBeatmapID != res.OnlineBeatmapID))
beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
LogForModel(set, $"Online retrieval mapped {beatmap} to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}."); LogForModel(set, $"Online retrieval mapped {beatmap} to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.");
} }
catch (Exception e) catch (Exception e)
{ {
fail(e);
}
void fail(Exception e)
{
beatmap.OnlineBeatmapID = null;
LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})"); LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})");
} }
} }