Browse Source

fix: crash on missing render frame (#31289)

Shelley Vohr 3 years ago
parent
commit
9c8bd18c41
1 changed files with 3 additions and 0 deletions
  1. 3 0
      shell/browser/api/electron_api_web_contents.cc

+ 3 - 0
shell/browser/api/electron_api_web_contents.cc

@@ -1706,6 +1706,9 @@ void WebContents::MessageTo(int32_t web_contents_id,
     gin::Handle<WebFrameMain> web_frame_main =
         WebFrameMain::From(JavascriptEnvironment::GetIsolate(), frame);
 
+    if (!web_frame_main->CheckRenderFrame())
+      return;
+
     int32_t sender_id = ID();
     web_frame_main->GetRendererApi()->Message(false /* internal */, channel,
                                               std::move(arguments), sender_id);