roydejong / BeatSaberServerBrowser

Beat Saber modification that adds a Server Browser to the Online menu, making it easy to share and join custom multiplayer games.
MIT License
102 stars 11 forks source link

Backing out of rich presence join can cause UI softlock #41

Closed roydejong closed 3 years ago

roydejong commented 3 years ago

Repro steps

  1. Accept a rich presence invite (via Discord or Steam)
  2. After the UI switches to the server browser, but before it goes to lobby, press "back" button in the UI
  3. You are now stuck in black screen (game throws UI nullref exception)

Underlying cause

This is due to how the UI is handled before going into a lobby; the game expects at least one view controller to be stacked on top of the mode selection. If that's not the case, the UI breaks.

[CRITICAL @ 20:30:47 | UnityEngine] ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
[CRITICAL @ 20:30:47 | UnityEngine] Parameter name: index
[CRITICAL @ 20:30:47 | UnityEngine] System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
[CRITICAL @ 20:30:47 | UnityEngine] System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
[CRITICAL @ 20:30:47 | UnityEngine] HMUI.FlowCoordinator.PresentFlowCoordinator (HMUI.FlowCoordinator flowCoordinator, System.Action finishedCallback, HMUI.ViewController+AnimationDirection animationDirection, System.Boolean immediately, System.Boolean replaceTopViewController) (at <4ed6ccd55f634459bd4b39b724b413c6>:0)
[CRITICAL @ 20:30:47 | UnityEngine] MultiplayerModeSelectionFlowCoordinator.<ResolveAndPresentNextFlowCoordinator>b__50_0 () (at <1307c473efb64193ac77f69250cf4916>:0)
[CRITICAL @ 20:30:47 | UnityEngine] FadeInOutController+<Fade>d__15.MoveNext () (at <09a448c281024307b38abd59cf7acfa0>:0)
[CRITICAL @ 20:30:47 | UnityEngine] UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <451019b49f1347529b43a32c5de769af>:0)