aboutsummaryrefslogtreecommitdiff
path: root/src/date-time.cpp
diff options
context:
space:
mode:
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;
}