Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm

Issue 2608733003: Check GetVisibleItem exists in GetFormattedURL (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) &&
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698