Skip to content

Commit 7c5f64e

Browse files
authored
UnityServicesUIHandler assumed that originalexception is non-null (#539)
fixed that with pattern-matched check
1 parent ee838ef commit 7c5f64e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Assets/BossRoom/Scripts/Client/UI/UnityServicesUIHandler.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ void ServiceErrorHandler(UnityServiceErrorMessage error)
2727
var errorMessage = error.Message;
2828
if (error.AffectedService == UnityServiceErrorMessage.Service.Lobby)
2929
{
30-
if ((error.OriginalException as LobbyServiceException).Reason == LobbyExceptionReason.LobbyConflict)
30+
if (error.OriginalException is LobbyServiceException lobbyServiceException)
3131
{
32-
// LobbyConflict can have multiple causes. Let's add other solutions here if there's other situations that arise for this.
33-
errorMessage += "\nSee logs for possible causes and solution.";
34-
Debug.LogError($"Got service error {error.Message} with LobbyConflict. Possible conflict cause: Trying to play with two builds on the " +
35-
$"same machine. Please use command line arg '{ClientMainMenuState.AuthProfileCommandLineArg} someName' to set a different auth profile.\n");
32+
if (lobbyServiceException.Reason == LobbyExceptionReason.LobbyConflict)
33+
{
34+
// LobbyConflict can have multiple causes. Let's add other solutions here if there's other situations that arise for this.
35+
errorMessage += "\nSee logs for possible causes and solution.";
36+
Debug.LogError($"Got service error {error.Message} with LobbyConflict. Possible conflict cause: Trying to play with two builds on the " +
37+
$"same machine. Please use command line arg '{ClientMainMenuState.AuthProfileCommandLineArg} someName' to set a different auth profile.\n");
38+
}
3639
}
3740
}
3841

0 commit comments

Comments
 (0)