Don't crash if the tm_zone field returned by localtime is NULL
authorjochen@chromium.org <jochen@chromium.org>
Wed, 5 Nov 2014 08:30:59 +0000 (08:30 +0000)
committerjochen@chromium.org <jochen@chromium.org>
Wed, 5 Nov 2014 08:31:19 +0000 (08:31 +0000)
BUG=chromium:158355
R=svenpanne@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/662093003

Cr-Commit-Position: refs/heads/master@{#25129}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25129 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/base/platform/platform-linux.cc

index eff5ced3b75f4c6f993b7548b47fbaf5aee506e6..b13a1e85c540eadf54a23735482c67c8b3bd9c0a 100644 (file)
@@ -109,7 +109,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
   if (std::isnan(time)) return "";
   time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
   struct tm* t = localtime(&tv);
-  if (NULL == t) return "";
+  if (!t || !t->tm_zone) return "";
   return t->tm_zone;
 #endif
 }