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

Unified Diff: components/reading_list/core/reading_list_entry.cc

Issue 2774393002: Fix DCHECK in ReadingListEntry. (Closed)
Patch Set: comment Created 3 years, 9 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: components/reading_list/core/reading_list_entry.cc
diff --git a/components/reading_list/core/reading_list_entry.cc b/components/reading_list/core/reading_list_entry.cc
index 25956e367ba40f24b9ca6d615cb554c43c7e4f07..8e3af18155b6f46130daf6ab6540f6de09b5ecd8 100644
--- a/components/reading_list/core/reading_list_entry.cc
+++ b/components/reading_list/core/reading_list_entry.cc
@@ -302,10 +302,15 @@ std::unique_ptr<ReadingListEntry> ReadingListEntry::FromReadingListLocal(
update_time_us = pb_entry.update_time_us();
}
- int64_t update_title_time_us = creation_time_us;
+ int64_t update_title_time_us = 0;
if (pb_entry.has_update_title_time_us()) {
update_title_time_us = pb_entry.update_title_time_us();
}
+ if (update_title_time_us == 0) {
+ // Entries created before title could be modified don't have
+ // update_title_time_us. Set it to creation_time_us for consistency.
+ update_title_time_us = creation_time_us;
+ }
State state = UNSEEN;
if (pb_entry.has_status()) {
@@ -418,10 +423,15 @@ std::unique_ptr<ReadingListEntry> ReadingListEntry::FromReadingListSpecifics(
update_time_us = pb_entry.update_time_us();
}
- int64_t update_title_time_us = creation_time_us;
+ int64_t update_title_time_us = 0;
if (pb_entry.has_update_title_time_us()) {
update_title_time_us = pb_entry.update_title_time_us();
}
+ if (update_title_time_us == 0) {
+ // Entries created before title could be modified don't have
+ // update_title_time_us. Set it to creation_time_us for consistency.
+ update_title_time_us = creation_time_us;
+ }
State state = UNSEEN;
if (pb_entry.has_status()) {
« 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