Throw an error if menu.popup() has no window

This commit is contained in:
Charles Kerr 2018-02-20 18:38:05 -06:00
parent 5a25b88b50
commit 9c56b81b71

View file

@ -60,11 +60,11 @@ Menu.prototype.popup = function (options) {
window = BrowserWindow.getFocusedWindow()
if (!window && wins && wins.length > 0) {
window = wins[0]
}
if (!window) {
throw new Error(`Cannot open Menu without a BrowserWindow present`)
}
}
}
this.popupAt(window, x, y, positioningItem, callback)
return { browserWindow: window, x, y, position: positioningItem }