Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rcelyte opened this issue Jun 25, 2022 · 2 comments

Comments

@rcelyte
Copy link
Contributor

rcelyte commented Jun 25, 2022

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)
...
@Goobwabber
Copy link
Owner

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants