Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #47 from brave/issue_45_dev_tools_shortcuts
Browse files Browse the repository at this point in the history
don't crash on tab or window close when no windows are active
  • Loading branch information
bbondy committed Dec 12, 2015
2 parents 5a63762 + d7a11fe commit 87c7b5a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,24 @@ const init = () => {
}, {
type: 'separator'
}, {
// this should be disabled when
// no windows are active
label: 'Close Window',
accelerator: 'CmdOrCtrl+Shift+W',
click: () => process.emit('close-window')
click: function (item, focusedWindow) {
if (focusedWindow) {
process.emit('close-window')
}
}
}, {
// this should be disabled when
// no windows are active
label: 'Close Tab',
accelerator: 'CmdOrCtrl+W',
click: function (item, focusedWindow) {
focusedWindow.webContents.send('shortcut-close-frame')
if (focusedWindow) {
focusedWindow.webContents.send('shortcut-close-frame')
}
}
}
]
Expand Down

0 comments on commit 87c7b5a

Please sign in to comment.