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

Unified Diff: chrome/browser/history/in_memory_url_index.cc

Issue 8785021: Be Careful when Accessing Map (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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: chrome/browser/history/in_memory_url_index.cc
===================================================================
--- chrome/browser/history/in_memory_url_index.cc (revision 112711)
+++ chrome/browser/history/in_memory_url_index.cc (working copy)
@@ -412,8 +412,14 @@
bool InMemoryURLIndex::HistoryItemFactorGreater::operator()(
const HistoryID h1,
const HistoryID h2) {
- const URLRow& r1(history_info_map_.find(h1)->second);
- const URLRow& r2(history_info_map_.find(h2)->second);
+ HistoryInfoMap::const_iterator entry1(history_info_map_.find(h1));
+ if (entry1 == history_info_map_.end())
+ return false;
+ HistoryInfoMap::const_iterator entry2(history_info_map_.find(h2));
+ if (entry2 == history_info_map_.end())
+ return true;
+ const URLRow& r1(entry1->second);
+ const URLRow& r2(entry2->second);
// First cut: typed count, visit count, recency.
// TODO(mrossetti): This is too simplistic. Consider an approach which ranks
// recently visited (within the last 12/24 hours) as highly important. Get
« 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