From 39a2d386f35dc3827cc1e7dfc63c0d97f5eb80eb Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Tue, 26 Oct 2021 14:08:37 +0100 Subject: [PATCH] add exception catching to QSBEvent --- QSB/Events/QSBEvent.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/QSB/Events/QSBEvent.cs b/QSB/Events/QSBEvent.cs index b22e2176..18fe3523 100644 --- a/QSB/Events/QSBEvent.cs +++ b/QSB/Events/QSBEvent.cs @@ -4,6 +4,7 @@ using QSB.Player; using QSB.Player.TransformSync; using QSB.Utility; using QuantumUNET.Components; +using System; namespace QSB.Events { @@ -78,14 +79,21 @@ namespace QSB.Events return; } - if (message.FromId == QSBPlayerManager.LocalPlayerId || - QSBPlayerManager.IsBelongingToLocalPlayer(message.FromId)) + try { - OnReceiveLocal(QSBCore.IsHost, message); - return; - } + if (message.FromId == QSBPlayerManager.LocalPlayerId || + QSBPlayerManager.IsBelongingToLocalPlayer(message.FromId)) + { + OnReceiveLocal(QSBCore.IsHost, message); + return; + } - OnReceiveRemote(QSBCore.IsHost, message); + OnReceiveRemote(QSBCore.IsHost, message); + } + catch (Exception ex) + { + DebugLog.ToConsole($"Error - Exception handling message {message.GetType().Name} : {ex}", MessageType.Error); + } } } } \ No newline at end of file