From 08a3e3a02ed9f314ed33446ed0ebe1bc16b2d3f8 Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Wed, 13 Jul 2022 16:35:47 -0400 Subject: [PATCH] fix: catch ipc errors --- client/ExtraChat/Integrations/ChatTwo.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/ExtraChat/Integrations/ChatTwo.cs b/client/ExtraChat/Integrations/ChatTwo.cs index a183fe2..626d2f3 100644 --- a/client/ExtraChat/Integrations/ChatTwo.cs +++ b/client/ExtraChat/Integrations/ChatTwo.cs @@ -24,13 +24,24 @@ internal class ChatTwo : IDisposable { this.Available = this.Plugin.Interface.GetIpcSubscriber("ChatTwo.Available"); this.Available.Subscribe(this.DoRegister); - this.DoRegister(); + try { + this.DoRegister(); + } catch (Exception) { + // try to register if chat 2 is already loaded + // if not, just ignore exception + } + this.Invoke.Subscribe(this.Integration); } public void Dispose() { if (this._id != null) { - this.Unregister.InvokeAction(this._id); + try { + this.Unregister.InvokeAction(this._id); + } catch (Exception) { + // no-op + } + this._id = null; }