summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/shared')
-rw-r--r--gui/src/shared/ipc-event-channel.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts
index 8cf09078cd..d9f9e4c3c3 100644
--- a/gui/src/shared/ipc-event-channel.ts
+++ b/gui/src/shared/ipc-event-channel.ts
@@ -1,4 +1,5 @@
import { ipcMain, ipcRenderer, WebContents } from 'electron';
+import log from 'electron-log';
import * as uuid from 'uuid';
import { IGuiSettingsState } from './gui-settings-state';
@@ -333,11 +334,19 @@ function requestHandler<T>(event: string): (fn: (...args: any[]) => Promise<T>)
try {
const result: RequestResult<T> = { type: 'success', value: await fn(...args) };
- ipcEvent.sender.send(responseEvent, result);
+ if (ipcEvent.sender.isDestroyed()) {
+ log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`);
+ } else {
+ ipcEvent.sender.send(responseEvent, result);
+ }
} catch (error) {
const result: RequestResult<T> = { type: 'error', message: error.message || '' };
- ipcEvent.sender.send(responseEvent, result);
+ if (ipcEvent.sender.isDestroyed()) {
+ log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`);
+ } else {
+ ipcEvent.sender.send(responseEvent, result);
+ }
}
});
};