diff options
author | John Layt <jlayt@kde.org> | 2014-01-06 19:20:58 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-11 20:45:22 +0100 |
commit | a41a5f6671616128eed650ad4742842b8e81a6ff (patch) | |
tree | 551196b6efdd50e514036c4361a910ceeae6d3b1 /src | |
parent | 46de0c476589cdc5ba02cb4c439cb4f4b3ba401f (diff) |
QDateTime - Fix isValid() if invalid QTimeZone
Explicitly check that the QTimeZone is valid before trying to use it.
Change-Id: Iec415a2cb07071502fe71ee5ac92a7657e818f99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 42721c018f..1ab5665893 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2764,6 +2764,15 @@ void QDateTimePrivate::refreshDateTime() return; } +#ifndef QT_BOOTSTRAPPED + // If not valid time zone then is invalid + if (m_spec == Qt::TimeZone && !m_timeZone.isValid()) { + clearValidDateTime(); + m_offsetFromUtc = 0; + return; + } +#endif // QT_BOOTSTRAPPED + // We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating // LocalTime and TimeZone might fall into "missing" DaylightTime transition hour // Calling toEpochMSecs will adjust the returned date/time if it does |