Commit 52d15921 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Tentative fix for crash

This CL fixes a crash where the navigationItem associated with a
BackForwardListItem is nil on a back/forward navigation, leading
to a null pointer crash.
If the associated item is nil, the code path is now the same as a
non-back/forwarad navigation.

Fixed: 1121950
Change-Id: Ic4b66af2dc9aa368ff046d66095cf090591eed57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2379724
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802824}
parent 1d45c973
...@@ -1289,8 +1289,12 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation( ...@@ -1289,8 +1289,12 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
item = [[CRWNavigationItemHolder item = [[CRWNavigationItemHolder
holderForBackForwardListItem:webView.backForwardList.currentItem] holderForBackForwardListItem:webView.backForwardList.currentItem]
navigationItem]; navigationItem];
userAgentType = item->GetUserAgentType(); // In some cases, the associated item isn't found. In that case, follow the
} else { // code path for the non-backforward navigations. See crbug.com/1121950.
if (item)
userAgentType = item->GetUserAgentType();
}
if (!item) {
// Get the visible item. There is no guarantee that the pending item belongs // Get the visible item. There is no guarantee that the pending item belongs
// to this navigation but it is very likely that it is the case. If there is // to this navigation but it is very likely that it is the case. If there is
// no pending item, it is probably a render initiated navigation. Use the // no pending item, it is probably a render initiated navigation. Use the
......
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