Skip to content

Commit

Permalink
replace try/catch in getWebFrameForEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak committed Sep 23, 2022
1 parent e24d0fd commit 7a67b91
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/browser/api/web-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,8 @@ const addReturnValueToEvent = (event: Electron.IpcMainEvent) => {
};

const getWebFrameForEvent = (event: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent) => {
try {
return webFrameMainBinding.fromIdOrNull(event.processId, event.frameId);
} catch {
return null;
}
if (!event.processId || !event.frameId) return false;
return webFrameMainBinding.fromIdOrNull(event.processId, event.frameId);
};

const commandLine = process._linkedBinding('electron_common_command_line');
Expand Down

0 comments on commit 7a67b91

Please sign in to comment.