From c8a3a00017d5eaca4e017a22d63acaebeb1e24d4 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 15 Mar 2022 10:45:56 -0700 Subject: [PATCH] fix: race condition where webContents can be nullptr during re-focus and a multi-window close sequence (#33063) * fix: race condition where webContents can be nullptr during re-focus and a multi-window close sequence * chore: update electron_inspectable_web_contents_view.mm --- .../browser/ui/cocoa/electron_inspectable_web_contents_view.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm index e4b797a001a1..3f86dca5158e 100644 --- a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm +++ b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm @@ -266,6 +266,8 @@ inspectableWebContentsView_->inspectable_web_contents(); DCHECK(inspectable_web_contents); auto* webContents = inspectable_web_contents->GetWebContents(); + if (!webContents) + return; auto* webContentsView = webContents->GetNativeView().GetNativeNSView(); NSView* view = [notification object];