From 3926eb573ee268e801087cee7b1cf1e3f05d0410 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 8 Mar 2022 14:28:47 +0100 Subject: [PATCH] qt: If the timestamp is 0, return a default QDateTime() Otherwise we are creating a date in the seventies that is believed to be true. --- qt/release.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qt/release.cpp b/qt/release.cpp index b41b8a91..e8a82aa9 100644 --- a/qt/release.cpp +++ b/qt/release.cpp @@ -91,12 +91,14 @@ QString Release::version() const QDateTime Release::timestamp() const { - return QDateTime::fromTime_t(as_release_get_timestamp(d->m_release)); + const guint64 timestamp = as_release_get_timestamp(d->m_release); + return timestamp > 0 ? QDateTime::fromTime_t(timestamp) : QDateTime(); } QDateTime Release::timestampEol() const { - return QDateTime::fromTime_t(as_release_get_timestamp_eol(d->m_release)); + const guint64 timestamp = as_release_get_timestamp_eol(d->m_release); + return timestamp > 0 ? QDateTime::fromTime_t(timestamp) : QDateTime(); } QString Release::description() const