summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2015-06-15 13:39:14 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-06-15 13:39:14 +0900
commitdd592451b8a65cb1a444691a88cef1d3fcc19fb2 (patch)
tree378418504d9ffd784574ce12087bcc2a0d5bf2cf
parent8ee96d16f1e311bbd08c992d45df83a415a36510 (diff)
clendar: + null check
gmtime can return NULL vaule. if so strftime will cause crash. this patch just prevent that potential situation.
-rw-r--r--src/lib/elm_calendar.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c
index 0fc78f338..90a6f17ab 100644
--- a/src/lib/elm_calendar.c
+++ b/src/lib/elm_calendar.c
@@ -1004,17 +1004,23 @@ _elm_calendar_evas_object_smart_add(Eo *obj, Elm_Calendar_Data *priv)
1004 /* FIXME: I'm not aware of a known max, so if it fails, 1004 /* FIXME: I'm not aware of a known max, so if it fails,
1005 * just make it larger. :| */ 1005 * just make it larger. :| */
1006 char buf[20]; 1006 char buf[20];
1007 struct tm *info;
1008
1007 /* I don't know of a better way of doing it */ 1009 /* I don't know of a better way of doing it */
1008 if (strftime(buf, sizeof(buf), "%a", gmtime(&weekday))) 1010 info = gmtime(&weekday);
1011 if (info)
1009 { 1012 {
1010 priv->weekdays[i] = eina_stringshare_add(buf); 1013 if (strftime(buf, sizeof(buf), "%a", info))
1011 } 1014 {
1012 else 1015 priv->weekdays[i] = eina_stringshare_add(buf);
1013 { 1016 }
1014 /* If we failed getting day, get a default value */ 1017 else
1015 priv->weekdays[i] = _days_abbrev[i]; 1018 {
1016 WRN("Failed getting weekday name for '%s' from locale.", 1019 /* If we failed getting day, get a default value */
1017 _days_abbrev[i]); 1020 priv->weekdays[i] = _days_abbrev[i];
1021 WRN("Failed getting weekday name for '%s' from locale.",
1022 _days_abbrev[i]);
1023 }
1018 } 1024 }
1019 weekday += 86400; /* Advance by a day */ 1025 weekday += 86400; /* Advance by a day */
1020 } 1026 }