MultiplayerCore icon indicating copy to clipboard operation
MultiplayerCore copied to clipboard

[BUG] Uncaught exception in MpEntitlementChecker when requesting old versions of BeatSaver maps

Open rcelyte opened this issue 3 years ago • 2 comments

MultiplayerCore Version 1.0.0

Your Platform PC

Describe the bug MpEntitlementChecker runs Enumerable.First() on the response received from BeatSaver, which throws instead of being handled gracefully if the requested hash isn't found. Such is the case with levels that have been revised after upload.

To Reproduce

  1. Request attached beatmap
  2. Observe other clients who don't have the song failing to respond to the entitlement check

Log

InvalidOperationException: Sequence contains no matching element
System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
MultiplayerCore.Objects.MpEntitlementChecker+<>c__DisplayClass13_0.<GetEntitlementStatus>b__0 (System.Threading.Tasks.Task`1[TResult] r) (at <ca5fd0a0d2364fa38cb3ebaefaa816a1>:0)
System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Threading.Tasks.Task.Execute () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
...

rcelyte avatar Jun 25 '22 09:06 rcelyte

Confused on how this would happen. The Enumerable.First() I use in MpEntitlementChecker has a predicate, so it finds the first version that has a matching level hash. The only way this would happen is if BeatSaver responds with a map that doesn't actually have a version with the same hash. I'll fix the error being thrown but it seems like something else is going wrong further up the line.

Goobwabber avatar Jun 27 '22 01:06 Goobwabber

Fixed in a9c5991a25385fa2954da89c3f4651df6104e161, leaving issue open for later though due to reason above.

Goobwabber avatar Jun 27 '22 01:06 Goobwabber