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

Unified Diff: ash/system/date/date_view.cc

Issue 10907178: Try to fix the possible bug in base::Time:Now() that can cause the crashing later in icu code calle… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Return null instead of zero for invalid Time::Now. Created 8 years, 3 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 | base/time_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/date/date_view.cc
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc
index 0ba186335bc698f30b8f527b1492dab41fb8e15d..1d84a0ef60542e7b5d9fba5b9ac013cb35b98177 100644
--- a/ash/system/date/date_view.cc
+++ b/ash/system/date/date_view.cc
@@ -181,6 +181,14 @@ void TimeView::UpdateTimeFormat() {
}
void TimeView::UpdateTextInternal(const base::Time& now) {
+ // Just in case |now| is null, do NOT update time; otherwise, it will
+ // crash icu code by calling into base::TimeFormatTimeOfDayWithHourClockType,
+ // see details in crbug.com/147570.
+ if (now.is_null()) {
+ LOG(ERROR) << "Received null value from base::Time |now| in argument";
+ return;
+ }
+
string16 current_time = base::TimeFormatTimeOfDayWithHourClockType(
now, hour_type_, base::kDropAmPm);
label_->SetText(current_time);
« no previous file with comments | « no previous file | base/time_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698