fix(sources): gracefully handle desktopCapturer.getSources failure

Catch errors from desktopCapturer.getSources() in the get-sources IPC
handler and return an empty array instead of crashing the handler.
Prevents repeated 'Failed to get sources' errors when screen recording
permission is not granted (common in dev mode on macOS 26).
This commit is contained in:
webadderall
2026-03-30 13:33:49 +11:00
parent 9aac961c1d
commit 3ff71f6a0b
+3
View File
@@ -2815,6 +2815,9 @@ export function registerIpcHandlers(
? await desktopCapturer.getSources({
...opts,
types: electronTypes,
}).catch((error) => {
console.warn('desktopCapturer.getSources failed (screen recording permission may be missing):', error)
return []
})
: []
const ownWindowNames = new Set(