fix: crash when failed to get devices in desktopCapturer (#17557)

* fix: crash when failed to get devices in desktopCapturer

* return after emit
This commit is contained in:
Shelley Vohr 2019-04-25 15:12:38 -07:00 committed by GitHub
parent 2ad942323c
commit c2c3a04628
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -26,7 +26,8 @@ ipcMainUtils.handle('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', (event, cap
thumbnailSize,
fetchWindowIcons
},
resolve
resolve,
reject
}
requestsQueue.push(request)
if (requestsQueue.length === 1) {
@ -46,6 +47,12 @@ desktopCapturer.emit = (event, name, sources, fetchWindowIcons) => {
const handledRequest = requestsQueue.shift()
const unhandledRequestsQueue = []
if (name === 'error') {
const error = sources
handledRequest.reject(error)
return
}
const result = sources.map(source => {
return {
id: source.id,