From 6d5484646297c146f5202cae667552416d5edac1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Nov 2019 10:18:47 +0900 Subject: [PATCH] Null online id on lookup failure --- osu.Game/Beatmaps/BeatmapManager.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 7057bd46bb..77fcf44a9b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -387,7 +387,7 @@ namespace osu.Game.Beatmaps var req = new GetBeatmapRequest(beatmap); - req.Failure += e => { LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})"); }; + req.Failure += fail; try { @@ -399,16 +399,18 @@ namespace osu.Game.Beatmaps beatmap.Status = res.Status; beatmap.BeatmapSet.Status = res.BeatmapSet.Status; beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; - - // 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; + beatmap.OnlineBeatmapID = res.OnlineBeatmapID; LogForModel(set, $"Online retrieval mapped {beatmap} to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}."); } catch (Exception e) { + fail(e); + } + + void fail(Exception e) + { + beatmap.OnlineBeatmapID = null; LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})"); } }