diff --git a/app/lib/zap/controller.js b/app/lib/zap/controller.js index f2f755b2..a7198f51 100644 --- a/app/lib/zap/controller.js +++ b/app/lib/zap/controller.js @@ -112,6 +112,12 @@ class ZapController { this.mainWindow.hide() } }) + + // Dereference the window object, usually you would store windows in an array if your app supports multi windows, + // this is the time when you should delete the corresponding element. + this.mainWindow.on('closed', () => { + this.mainWindow = null + }) } // ------------------------------------ diff --git a/app/main.dev.js b/app/main.dev.js index 69955f79..1dcbd737 100644 --- a/app/main.dev.js +++ b/app/main.dev.js @@ -109,7 +109,9 @@ app.on('ready', () => { event.preventDefault() zap.terminate() } else { - zap.mainWindow.forceClose = true + if (zap.mainWindow) { + zap.mainWindow.forceClose = true + } } })