Commit 90253a3d authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

ios: Properly handle nil restored_visible_items.

Bug: 1127434
Change-Id: I63c5db473c2987eebc3605206eff64aeb4db3490
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461976
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Auto-Submit: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815231}
parent 8af1f537
......@@ -123,7 +123,7 @@ void WKBasedNavigationManagerImpl::OnNavigationStarted(const GURL& url) {
// last_committed_web_view_item_ as the origins mistmatch.
int index = GetLastCommittedItemIndexInCurrentOrRestoredSession();
DCHECK(index != -1 || 0 == GetItemCount());
if (index != -1 &&
if (index != -1 && restored_visible_item_ &&
restored_visible_item_->GetUserAgentType() != UserAgentType::NONE) {
NavigationItemImpl* last_committed_item =
GetNavigationItemImplAtIndex(static_cast<size_t>(index));
......@@ -424,7 +424,8 @@ bool WKBasedNavigationManagerImpl::ShouldBlockUrlDuringRestore(
// Abort restore.
DiscardNonCommittedItems();
last_committed_item_index_ = web_view_cache_.GetCurrentItemIndex();
if (restored_visible_item_->GetUserAgentType() != UserAgentType::NONE) {
if (restored_visible_item_ &&
restored_visible_item_->GetUserAgentType() != UserAgentType::NONE) {
NavigationItem* last_committed_item =
GetLastCommittedItemInCurrentOrRestoredSession();
last_committed_item->SetUserAgentType(
......
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