Index: ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm |
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm |
index 6d4d518e67b94e7dc1be84c1ec0f3c2cb15a1cd3..e8db613dfaeee4c63fa8f59d465bb1da4142db00 100644 |
--- a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm |
+++ b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm |
@@ -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) && |