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

@ -25,18 +25,32 @@ namespace ml_aci
static void OnLocalAvatarLoad()
{
if(ViewManager.Instance != null)
ViewManager.Instance.TriggerPushNotification("Avatar changed", 1f);
try
{
if(ViewManager.Instance != null)
ViewManager.Instance.TriggerPushNotification("Avatar changed", 1f);
}
catch(System.Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
static void OnPropSpawned()
{
if(ViewManager.Instance != null)
try
{
if((NetworkManager.Instance != null) && (NetworkManager.Instance.GameNetwork.ConnectionState == ConnectionState.Connected))
ViewManager.Instance.TriggerPushNotification("Prop spawned", 1f);
else
ViewManager.Instance.TriggerAlert("Prop Error", "Not connected to live instance", -1, true);
if(ViewManager.Instance != null)
{
if((NetworkManager.Instance != null) && (NetworkManager.Instance.GameNetwork.ConnectionState == ConnectionState.Connected))
ViewManager.Instance.TriggerPushNotification("Prop spawned", 1f);
else
ViewManager.Instance.TriggerAlert("Prop Error", "Not connected to live instance", -1, true);
}
}
catch(System.Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
}