Skip to content

Commit

Permalink
Fix: Treat mapId=0 as invalid mapid, so search can fallback to other …
Browse files Browse the repository at this point in the history
…search methods (by default MSN)
  • Loading branch information
Piotrekol committed Sep 11, 2018
1 parent 8ae6a95 commit 24fc506
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,22 @@ public void ConsumerTask()
//Here we prioritize Memory events over MSN/other.
if (TasksMemory.TryPop(out searchArgs))
{
searchResult = _mainMapDataGetter.FindMapData(searchArgs);
if (searchResult.FoundBeatmaps)
if (searchArgs.MapId == 0)
{
memorySearchFailed = false;
searchResult.EventSource = searchArgs.SourceName;
_mainMapDataGetter.ProcessMapResult(searchResult);
memorySearchFailed = true;
}
else
memorySearchFailed = true;
{
searchResult = _mainMapDataGetter.FindMapData(searchArgs);
if (searchResult.FoundBeatmaps)
{
memorySearchFailed = false;
searchResult.EventSource = searchArgs.SourceName;
_mainMapDataGetter.ProcessMapResult(searchResult);
}
else
memorySearchFailed = true;
}
}
if (memorySearchFailed)
{
Expand Down
6 changes: 6 additions & 0 deletions plugins/OsuMemoryEventSource/OsuMemoryEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public MapSearchResult FindBeatmap(MapSearchArgs searchArgs)
return result;
}

if (mapId == 0)
{
Logger?.Log("Map has no ID", LogLevel.Advanced);
return result;
}

var b = _sqLiteController.GetBeatmap(mapId);
if (b != null)
{
Expand Down

0 comments on commit 24fc506

Please sign in to comment.