fix: catch ipc errors

This commit is contained in:
Anna 2022-07-13 16:35:47 -04:00
parent d16eb7f084
commit 08a3e3a02e
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0

View File

@ -24,13 +24,24 @@ internal class ChatTwo : IDisposable {
this.Available = this.Plugin.Interface.GetIpcSubscriber<object?>("ChatTwo.Available"); this.Available = this.Plugin.Interface.GetIpcSubscriber<object?>("ChatTwo.Available");
this.Available.Subscribe(this.DoRegister); 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); this.Invoke.Subscribe(this.Integration);
} }
public void Dispose() { public void Dispose() {
if (this._id != null) { if (this._id != null) {
this.Unregister.InvokeAction(this._id); try {
this.Unregister.InvokeAction(this._id);
} catch (Exception) {
// no-op
}
this._id = null; this._id = null;
} }