From 754889393f74da7481275d656d461d955b478c0b Mon Sep 17 00:00:00 2001 From: Damon Yu Date: Mon, 16 Dec 2024 17:32:26 +0800 Subject: [PATCH] fix: check web content is crashed or not before call ipc send --- src/main/ElectronExternalApi.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/ElectronExternalApi.js b/src/main/ElectronExternalApi.js index b37eb58..6c6adb2 100644 --- a/src/main/ElectronExternalApi.js +++ b/src/main/ElectronExternalApi.js @@ -175,7 +175,10 @@ class ElectronExternalApi extends NodeExternalApi { */ sendIpc(channel, message) { this.electron.BrowserWindow?.getAllWindows()?.forEach((wnd) => { - if (wnd.webContents?.isDestroyed() === false) { + if ( + wnd.webContents?.isDestroyed() === false + && wnd.webContents?.isCrashed() === false + ) { wnd.webContents.send(channel, message); } });