summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-08-20 17:26:34 +0200
committerAndrej Mihajlov <and@mullvad.net>2019-08-22 16:30:55 +0200
commitf4684db310737186cc8ce9a2aa3397fbdb33c974 (patch)
tree011ecfcf3a457f8a55f7c69e6c11f3c87460ea93 /gui/src/shared
parenta4d3639562ab882dfcb854b7494c7fd39a9022ba (diff)
downloadmullvadvpn-f4684db310737186cc8ce9a2aa3397fbdb33c974.tar.xz
mullvadvpn-f4684db310737186cc8ce9a2aa3397fbdb33c974.zip
Guard the calls to webContents.send
Diffstat (limited to 'gui/src/shared')
-rw-r--r--gui/src/shared/ipc-event-channel.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts
index a11d41bf10..f57368db2d 100644
--- a/gui/src/shared/ipc-event-channel.ts
+++ b/gui/src/shared/ipc-event-channel.ts
@@ -361,13 +361,21 @@ function set<T>(event: string): (value: T) => void {
function sender<T>(event: string): (webContents: WebContents, value: T) => void {
return (webContents: WebContents, value: T) => {
- webContents.send(event, value);
+ if (webContents.isDestroyed()) {
+ log.error(`sender(${event}): webContents is already destroyed!`);
+ } else {
+ webContents.send(event, value);
+ }
};
}
function senderVoid(event: string): (webContents: WebContents) => void {
return (webContents: WebContents) => {
- webContents.send(event);
+ if (webContents.isDestroyed()) {
+ log.error(`senderVoid(${event}): webContents is already destroyed!`);
+ } else {
+ webContents.send(event);
+ }
};
}