Try-catch statements for Harmony patches

This commit is contained in:
SDraw 2022-09-13 08:09:33 +03:00
parent bee29e7771
commit 4e3d5dd6d4
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
6 changed files with 93 additions and 37 deletions

View file

@ -16,8 +16,15 @@ namespace ml_sci
static void OnGameNetworkConnectionClosed(object __0, DisconnectedEventArgs __1)
{
if((CohtmlHud.Instance != null) && (__1 != null) && (!__1.LocalDisconnect))
CohtmlHud.Instance.ViewDropTextImmediate("(Local) Client", "Connection lost", (__1.Error != System.Net.Sockets.SocketError.Success) ? ("Reason: " + __1.Error.ToString()) : "");
try
{
if((CohtmlHud.Instance != null) && (__1 != null) && (!__1.LocalDisconnect))
CohtmlHud.Instance.ViewDropTextImmediate("(Local) Client", "Connection lost", (__1.Error != System.Net.Sockets.SocketError.Success) ? ("Reason: " + __1.Error.ToString()) : "");
}
catch(System.Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
}
}