From 519e337e8778fdd0b911f0e0a4a6b43baeb6c8c8 Mon Sep 17 00:00:00 2001 From: Pedro Bertao Date: Mon, 19 Aug 2019 16:55:16 -0300 Subject: [PATCH] fix object destroyed when darwin apps are on hold in memory --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 251fb34..b30b64b 100644 --- a/src/index.js +++ b/src/index.js @@ -68,6 +68,9 @@ function onNotification(webContents) { // Update persistentId config.set('persistentIds', [...persistentIds, persistentId]); // Notify the renderer process that a new notification has been received - webContents.send(NOTIFICATION_RECEIVED, notification); + // And check if window is not destroyed for darwin Apps + if(!webContents.isDestroyed()){ + webContents.send(NOTIFICATION_RECEIVED, notification); + } }; }