Skip to content

Commit

Permalink
fix: check web content is crashed or not before call ipc send (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonYu6 authored Dec 16, 2024
1 parent 2520d8a commit 5fbc131
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/ElectronExternalApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down

0 comments on commit 5fbc131

Please sign in to comment.