diff --git a/Hitbloq/Entries/HitbloqLevelInfo.cs b/Hitbloq/Entries/HitbloqLevelInfo.cs index 206aa5b..3bd4dc8 100644 --- a/Hitbloq/Entries/HitbloqLevelInfo.cs +++ b/Hitbloq/Entries/HitbloqLevelInfo.cs @@ -5,6 +5,9 @@ namespace Hitbloq.Entries { internal class HitbloqLevelInfo { + [JsonProperty("error")] + public string? Error { get; private set; } + [JsonProperty("star_rating")] public ReadOnlyDictionary Pools { get; private set; } = null!; } diff --git a/Hitbloq/Sources/LevelInfoSource.cs b/Hitbloq/Sources/LevelInfoSource.cs index 7196f77..f016a84 100644 --- a/Hitbloq/Sources/LevelInfoSource.cs +++ b/Hitbloq/Sources/LevelInfoSource.cs @@ -22,7 +22,7 @@ public LevelInfoSource(IHttpService siraHttpService) { if (_cache.TryGetValue(difficultyBeatmap, out var cachedValue)) { - return cachedValue; + return cachedValue; } var beatmapString = Utils.DifficultyBeatmapToString(difficultyBeatmap); @@ -36,6 +36,11 @@ public LevelInfoSource(IHttpService siraHttpService) var webResponse = await _siraHttpService.GetAsync($"{PluginConfig.Instance.HitbloqURL}/api/leaderboard/{beatmapString}/info", cancellationToken: cancellationToken).ConfigureAwait(false); var levelInfo = await Utils.ParseWebResponse(webResponse); + if (levelInfo?.Error != null) + { + return null; + } + _cache[difficultyBeatmap] = levelInfo; return levelInfo; }