aboutsummaryrefslogtreecommitdiff
path: root/src/date-time.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-26 10:48:21 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-02-26 10:48:21 -0600
commitd857a4d1cbc7c0853a88064536957dd0d225418f (patch)
tree2ea9deeed3d59f0d8d8ea78f992fab2fb4255786 /src/date-time.cpp
parentbb4bb77908d8ccd80260aee4541e45d0a075b0ad (diff)
downloadayatana-indicator-datetime-d857a4d1cbc7c0853a88064536957dd0d225418f.tar.gz
ayatana-indicator-datetime-d857a4d1cbc7c0853a88064536957dd0d225418f.tar.bz2
ayatana-indicator-datetime-d857a4d1cbc7c0853a88064536957dd0d225418f.zip
in DateTime::format(), don't assign NULL to a std::string
Diffstat (limited to 'src/date-time.cpp')
-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;
}