From 2d989fccc22d31bed58300277cbe47be0a7875e2 Mon Sep 17 00:00:00 2001 From: kytwb Date: Fri, 24 Dec 2021 13:20:09 +0100 Subject: Prevent error swallowing on autoUpdate event --- src/stores/AppStore.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/stores') diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 2698749fc..cdb8586ca 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js @@ -162,27 +162,29 @@ export default class AppStore extends Store { // Check for an update in 30s (need a delay to prevent Squirrel Installer lock file issues) setTimeout(() => this._checkForUpdates(), ms('30s')); ipcRenderer.on('autoUpdate', (event, data) => { - if (data.available) { - this.updateStatus = this.updateStatusTypes.AVAILABLE; - if (isMac && this.stores.settings.app.automaticUpdates) { - app.dock.bounce(); + if (this.updateStatus !== this.updateStatusTypes.FAILED) { + if (data.available) { + this.updateStatus = this.updateStatusTypes.AVAILABLE; + if (isMac && this.stores.settings.app.automaticUpdates) { + app.dock.bounce(); + } } - } - if (data.available !== undefined && !data.available) { - this.updateStatus = this.updateStatusTypes.NOT_AVAILABLE; - } + if (data.available !== undefined && !data.available) { + this.updateStatus = this.updateStatusTypes.NOT_AVAILABLE; + } - if (data.downloaded) { - this.updateStatus = this.updateStatusTypes.DOWNLOADED; - if (isMac && this.stores.settings.app.automaticUpdates) { - app.dock.bounce(); + if (data.downloaded) { + this.updateStatus = this.updateStatusTypes.DOWNLOADED; + if (isMac && this.stores.settings.app.automaticUpdates) { + app.dock.bounce(); + } } - } - if (data.error) { - console.log('Updater error:', data.error); - this.updateStatus = this.updateStatusTypes.FAILED; + if (data.error) { + console.log('Updater error:', data.error); + this.updateStatus = this.updateStatusTypes.FAILED; + } } }); -- cgit v1.2.3-54-g00ecf