diff --git a/GameSDKcraft/Plugin.cs b/GameSDKcraft/Plugin.cs index f1ec486..c456515 100644 --- a/GameSDKcraft/Plugin.cs +++ b/GameSDKcraft/Plugin.cs @@ -246,7 +246,18 @@ namespace GamecraftRPC public void OnUpdate() // called once per rendered frame (frame update) { - if (DiscordRPC != null ) DiscordRPC.RunCallbacks(); + if (DiscordRPC != null) + { + try + { + DiscordRPC.RunCallbacks(); + } + catch (ResultException e) + { + GamecraftModdingAPI.Utility.Logging.LogWarning($"Discord integration has been disabled due to the exception " + e); + DiscordRPC = null; + } + } } public static void SetDiscordActivity(string state = null, string details = null, long start = 0, long end = 0, string largeImg = "gamecraft-logo-g", string largeTxt = "Gamecraft", string smallImg = "exmods-logo-xm2", string smallTxt = null, string partyId = null, int partyCurrentSize = 0, int partyMaxSize = 0, string matchSecret = null, string joinSecret = null, string spectateSecret = null, bool instance = true, string debug = "")