diff --git a/lib/utils/mu-utils.cc b/lib/utils/mu-utils.cc index 5afd7ab4..ee33518b 100644 --- a/lib/utils/mu-utils.cc +++ b/lib/utils/mu-utils.cc @@ -266,12 +266,18 @@ Mu::date_to_time_t_string(int64_t t) std::string Mu::time_to_string(const std::string& frm, time_t t, bool utc) { - GDateTime* dt = [&] { + GDateTime* dt = std::invoke([&] { if (utc) return g_date_time_new_from_unix_utc(t); else return g_date_time_new_from_unix_local(t); - }(); + }); + + if (!dt) { + g_warning("time_t out of range: <%" G_GUINT64_FORMAT ">", + static_cast(t)); + return {}; + } char* str = g_date_time_format(dt, frm.c_str()); g_date_time_unref(dt);