NavigationControllerImpl::NavigateToNavigationApiKey should not crash on a null committed origin

Fixed: 403308727
Test: NavigationControllerBrowserTest.NavigateToNavigationApiKey_NullCommittedOrigin
Change-Id: Ic2fe9c6e01e48981096e381ffc202ce8f429b5ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6405178
Commit-Queue: Nate Chapin <[email protected]>
Reviewed-by: Rakina Zata Amni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1439499}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index 00d0926..1107361b 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -4944,8 +4944,9 @@
   FrameTreeNode* node = initiator_rfh->frame_tree_node();
   FrameNavigationEntry* current_entry =
       GetLastCommittedEntry()->GetFrameEntry(node);
-  if (!current_entry)
+  if (!current_entry || !current_entry->committed_origin()) {
     return;
+  }
 
   // TODO(crbug.com/40878000): Make sure that the right task ID is passed
   // when `navigation.traverseTo()` is called.