Commit ec939068 authored by olivierrobin's avatar olivierrobin Committed by Commit bot

Check GetVisibleItem exists in GetFormattedURL

When Clearing Presented state, it is possible that no Visible item
exists.
Check before dereferencing.

Fix cl/2606873002

BUG=674986

Review-Url: https://codereview.chromium.org/2608733003
Cr-Commit-Position: refs/heads/master@{#440957}
parent 311f7c0a
......@@ -84,6 +84,11 @@ bool ToolbarModelImplIOS::ShouldDisplayHintText() {
base::string16 ToolbarModelImplIOS::GetFormattedURL(size_t* prefix_end) const {
base::string16 formatted_url = toolbar_model_->GetFormattedURL(prefix_end);
Tab* current_tab = delegate_->GetCurrentTab();
if (!current_tab || !current_tab.webState ||
!current_tab.webState->GetNavigationManager() ||
!current_tab.webState->GetNavigationManager()->GetVisibleItem()) {
return formatted_url;
}
GURL url =
current_tab.webState->GetNavigationManager()->GetVisibleItem()->GetURL();
if (reading_list::IsOfflineURL(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