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

Unified Diff: content/browser/host_zoom_map_impl.cc

Issue 320863002: Don't assume WebContents has a LastCommittedEntry when setting zoom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 6 years, 6 months 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: content/browser/host_zoom_map_impl.cc
diff --git a/content/browser/host_zoom_map_impl.cc b/content/browser/host_zoom_map_impl.cc
index a0a68dad95a2c860e42b0bb9dc3f519882a6a8b2..c52d54f8f86074dcb63890c56c5ba94462b843b3 100644
--- a/content/browser/host_zoom_map_impl.cc
+++ b/content/browser/host_zoom_map_impl.cc
@@ -247,11 +247,14 @@ void HostZoomMapImpl::SetZoomLevelForWebContents(
// WebContentsImpl::GetLastCommittedURL() may give us a virtual url that
// is different than what the render view is using. If the two don't match,
// the attempt to set the zoom will fail.
- GURL url;
NavigationEntry* entry =
web_contents_impl.GetController().GetLastCommittedEntry();
- DCHECK(entry);
- url = entry->GetURL();
+ // Tests may invoke this function with a null entry, but we don't
+ // want to save zoom levels in this case.
+ if (!entry)
+ return;
+
+ GURL url = entry->GetURL();
SetZoomLevelForHost(net::GetHostOrSpecFromURL(url), level);
}
}
« 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