diff options
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/ipc-helpers.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gui/src/shared/ipc-helpers.ts b/gui/src/shared/ipc-helpers.ts index 59eee46459..8c3c851a80 100644 --- a/gui/src/shared/ipc-helpers.ts +++ b/gui/src/shared/ipc-helpers.ts @@ -4,7 +4,7 @@ import log from './logging'; type Handler<T, R> = (callback: (arg: T) => R) => void; type Sender<T, R> = (arg: T) => R; -type Notifier<T> = (webContents: WebContents, arg: T) => void; +type Notifier<T> = (webContents: WebContents | undefined, arg: T) => void; type Listener<T> = (callback: (arg: T) => void) => void; interface MainToRenderer<T> { @@ -152,8 +152,8 @@ export function notifyRenderer<T>(): MainToRenderer<T> { } function notifyRendererImpl<T>(event: string, _ipcMain: EIpcMain): Notifier<T> { - return (webContents: WebContents, value: T) => { - if (webContents.isDestroyed()) { + return (webContents, value) => { + if (webContents === undefined) { log.error(`sender(${event}): webContents is already destroyed!`); } else { webContents.send(event, value); |
