Skip to content

Commit 92c9764

Browse files
committed
Guard against erroneous disposal (fixes #28)
During plugin updates, Hyper calls the `clearCache` method. This method appears to execute `onUnload` without the context of `onApp`. Adding a guard clause as a quick-fix, as I do not fully understand what is taking place currently.
1 parent 2738a10 commit 92c9764

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

modules/dispose.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
const { showWindows } = require('./windows')
33

44
module.exports = (app, callbacks) => {
5-
const { handleActivate, handleBlur, cfgUnsubscribe } = callbacks
5+
const { cfgUnsubscribe, handleActivate, handleBlur } = callbacks
6+
7+
if (!cfgUnsubscribe || !handleActivate || !handleBlur) {
8+
return
9+
}
610

711
showWindows(app)
812
app.dock.show()
9-
// TODO: Un-register shortcut when supported
13+
// TODO: Unregister shortcut when supported
1014
// unregisterShortcut()
15+
1116
cfgUnsubscribe()
1217
app.removeListener('activate', handleActivate)
1318
app.removeListener('browser-window-blur', handleBlur)

0 commit comments

Comments
 (0)