summaryrefslogtreecommitdiffstats
path: root/src/sources
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2021-06-17 19:56:39 +0200
committerUwe Klotz <uklotz@mixxx.org>2021-06-17 20:01:45 +0200
commit1b21ee2b6fe6386f097bc08f2dc6658ba6c49c09 (patch)
tree1b792ac321e611a9d46fcd87de294a0f88f98a96 /src/sources
parent8d3fbc3e2f92c3e17560155ea26a55ab80d09cbd (diff)
Fix undefined behavior of toMSecsSinceEpoch() if QDateTime is not valid
https://doc.qt.io/qt-5/qdatetime.html#toMSecsSinceEpoch
Diffstat (limited to 'src/sources')
-rw-r--r--src/sources/metadatasourcetaglib.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sources/metadatasourcetaglib.cpp b/src/sources/metadatasourcetaglib.cpp
index 6684e820ef..9893623e29 100644
--- a/src/sources/metadatasourcetaglib.cpp
+++ b/src/sources/metadatasourcetaglib.cpp
@@ -80,7 +80,9 @@ inline QDateTime getSourceSynchronizedAt(const QFileInfo& fileInfo) {
// Ignore bogus values like 1970-01-01T00:00:00.000 UTC
// that are obviously incorrect and don't provide any
// information.
- if (lastModifiedUtc.toMSecsSinceEpoch() == 0) {
+ if (lastModifiedUtc.isValid() &&
+ // Only defined if valid
+ lastModifiedUtc.toMSecsSinceEpoch() == 0) {
return QDateTime{};
}
return lastModifiedUtc;