Skip to content

Commit a948446

Browse files
committed
Adding try/catch to LeaveBeforeQuit to make sure that we quit even if exceptions happen (#563)
(cherry picked from commit eecfe7e)
1 parent 107af0f commit a948446

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Assets/BossRoom/Scripts/Shared/ApplicationController.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
using System;
12
using System.Collections;
23
using BossRoom.Scripts.Shared.Net.UnityServices.Auth;
34
using Unity.Multiplayer.Samples.BossRoom.Client;
45
using Unity.Multiplayer.Samples.BossRoom.Server;
56
using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
67
using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure;
78
using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies;
9+
using Unity.Multiplayer.Samples.Utilities;
810
using Unity.Netcode;
911
using UnityEngine;
1012
using UnityEngine.SceneManagement;
@@ -87,7 +89,15 @@ private void OnDestroy()
8789
/// </summary>
8890
private IEnumerator LeaveBeforeQuit()
8991
{
90-
m_LobbyServiceFacade.ForceLeaveLobbyAttempt();
92+
// We want to quit anyways, so if anything happens while trying to leave the Lobby, log the exception then carry on
93+
try
94+
{
95+
m_LobbyServiceFacade.ForceLeaveLobbyAttempt();
96+
}
97+
catch (Exception e)
98+
{
99+
Debug.LogError(e.Message);
100+
}
91101
yield return null;
92102
Application.Quit();
93103
}

0 commit comments

Comments
 (0)