Commit 3a7192d2 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

ios: Fix crash in RestoreItemsState.

GetNavigationItemImplAtIndex() appears to return a nil |cached_item|
sometimes, perhaps due to a mismatch in WKWebView's backForwardList.
Returning early when this happens in RestoreItemsState() may break
some restore state features, but should not put the user in a broken
state.

Bug: 1134096
Change-Id: I47a2f1316375860b223fa988e7aca9e4557057d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454291Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815204}
parent b499878a
......@@ -794,6 +794,13 @@ void WKBasedNavigationManagerImpl::RestoreItemsState(
cache_index, true /* create_if_missing */);
NavigationItem* restore_item = items_restored[index].get();
// |cached_item| appears to be nil sometimes, perhaps due to a mismatch in
// WKWebView's backForwardList. Returning early here may break some restore
// state features, but should not put the user in a broken state.
if (!cached_item || !restore_item) {
continue;
}
bool is_same_url = cached_item->GetURL() == restore_item->GetURL();
if (wk_navigation_util::IsRestoreSessionUrl(cached_item->GetURL())) {
GURL target_url;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment