Skip to content

Commit

Permalink
handle null beatmap version
Browse files Browse the repository at this point in the history
  • Loading branch information
Goobwabber committed Jun 27, 2022
1 parent b16fb7a commit a9c5991
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MultiplayerCore/Objects/MpEntitlementChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ public override Task<EntitlementsStatus> GetEntitlementStatus(string levelId)
if (beatmap == null)
return EntitlementsStatus.NotOwned;

BeatmapVersion beatmapVersion = beatmap.Versions.First(x => string.Equals(x.Hash, levelHash, StringComparison.OrdinalIgnoreCase));
string[] requirements = beatmapVersion.Difficulties
BeatmapVersion? beatmapVersion = beatmap.Versions.FirstOrDefault(x => string.Equals(x.Hash, levelHash, StringComparison.OrdinalIgnoreCase));
if (beatmapVersion == null)
return EntitlementsStatus.NotOwned;

string[] requirements = beatmapVersion.Difficulties
.Aggregate(Array.Empty<string>(), (a, n) => a
.Append(n.Chroma ? "Chroma" : "")
.Append(n.MappingExtensions ? "Mapping Extensions" : "")
Expand Down

0 comments on commit a9c5991

Please sign in to comment.