Skip to content

Commit

Permalink
More defensive against errors from Electron
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Oct 2, 2023
1 parent 4ad1fbb commit b878397
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ async function newProtocolRenderer(): Promise<void> {
}

if (!wc.isDestroyed()) {
const windowId: string | undefined = await wc.executeJavaScript('window.__SENTRY_RENDERER_ID__');

if (windowId) {
KNOWN_RENDERERS.add(wcId);
WINDOW_ID_TO_WEB_CONTENTS.set(windowId, wcId);

wc.once('destroyed', () => {
KNOWN_RENDERERS?.delete(wcId);
WINDOW_ID_TO_WEB_CONTENTS?.delete(windowId);
});
try {
const windowId: string | undefined = await wc.executeJavaScript('window.__SENTRY_RENDERER_ID__');

if (windowId) {
KNOWN_RENDERERS.add(wcId);
WINDOW_ID_TO_WEB_CONTENTS.set(windowId, wcId);

wc.once('destroyed', () => {
KNOWN_RENDERERS?.delete(wcId);
WINDOW_ID_TO_WEB_CONTENTS?.delete(windowId);
});
}
} catch (_) {
// ignore
}
}
}
Expand Down

0 comments on commit b878397

Please sign in to comment.