aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-27 10:59:07 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-02-27 10:59:07 +0000
commite60d563f9f0b36b91533bda083ea30b0f8420ff1 (patch)
tree8805039678338bf706749420249609f864405a29 /src
parent4359a9d039155a9551a41193bc53540b8c2506c9 (diff)
parentd857a4d1cbc7c0853a88064536957dd0d225418f (diff)
downloadayatana-indicator-datetime-e60d563f9f0b36b91533bda083ea30b0f8420ff1.tar.gz
ayatana-indicator-datetime-e60d563f9f0b36b91533bda083ea30b0f8420ff1.tar.bz2
ayatana-indicator-datetime-e60d563f9f0b36b91533bda083ea30b0f8420ff1.zip
DateTime::format(), don't pass NULL to a std::string's assignment operator Fixes: 1285243
Diffstat (limited to 'src')
-rw-r--r--src/date-time.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/date-time.cpp b/src/date-time.cpp
index e6d99cd..432d877 100644
--- a/src/date-time.cpp
+++ b/src/date-time.cpp
@@ -85,9 +85,15 @@ GDateTime* DateTime::get() const
std::string DateTime::format(const std::string& fmt) const
{
- const auto str = g_date_time_format(get(), fmt.c_str());
- std::string ret = str;
- g_free(str);
+ std::string ret;
+
+ gchar* str = g_date_time_format(get(), fmt.c_str());
+ if (str)
+ {
+ ret = str;
+ g_free(str);
+ }
+
return ret;
}