Skip to content

Commit 0695f5c

Browse files
committed
Guard against no app icon
1 parent 926b72e commit 0695f5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main-process/native-ui/tray/tray.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ ipc.on('put-in-tray', function (event) {
1515
label: 'Remove',
1616
click: function () {
1717
event.sender.send('tray-removed')
18-
appIcon.destroy()
18+
if (appIcon) appIcon.destroy()
1919
}
2020
}])
2121
appIcon.setToolTip('Electron Demo in the tray.')
2222
appIcon.setContextMenu(contextMenu)
2323
})
2424

2525
ipc.on('remove-tray', function () {
26-
appIcon.destroy()
26+
if (appIcon) appIcon.destroy()
2727
})
2828

2929
app.on('window-all-closed', function () {
30-
appIcon.destroy()
30+
if (appIcon) appIcon.destroy()
3131
})

0 commit comments

Comments
 (0)