From f423641adf6db9b5cf9cc20700ebfde1fe6a8f87 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 2 Dec 2024 12:04:46 +0200 Subject: [PATCH] Return empty string when date is null Signed-off-by: Raul Metsma --- src/util/DateTime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/DateTime.cpp b/src/util/DateTime.cpp index bf949e89c..cd74227f0 100644 --- a/src/util/DateTime.cpp +++ b/src/util/DateTime.cpp @@ -68,7 +68,7 @@ string date::to_string(time_t t) string date::to_string(const tm &date) { string result(20, 0); - if(strftime(result.data(), result.size() + 1, "%Y-%m-%dT%H:%M:%SZ", &date) == 0) + if(is_empty(date) || strftime(result.data(), result.size() + 1, "%Y-%m-%dT%H:%M:%SZ", &date) == 0) result.clear(); return result; }