diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-03-21 16:10:09 +0100 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2019-03-22 07:32:45 +0000 |
commit | 1119cd4ece6555be82212b273d05d581bffb79d1 (patch) | |
tree | 58a7f5f8856b1bfccd21cd8c522473ef418ccc93 /src/corelib | |
parent | 0211774c6803b6d530ab2b804ab310f733567dfe (diff) |
Correct a misguided assertion in QTzTimeZonePrivate
Without ICU, the TZ-DB backend for time-zones tripped over an
assertion when running tst_QTimeZone::stressTest(), which happened to
probe a zone between its last transition and the first transition of a
POSIX rule that followed it. The code assumed there was no interval
between these two; apparently, there can be.
Change-Id: I3d0ad41fec0a255db2f9bfac54d33aa9b83938e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_tz.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index bed62a02bd..fa4ec031fa 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -1022,8 +1022,10 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecs [beforeMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch < beforeMSecsSinceEpoch; }); - Q_ASSERT(it > posixTrans.cbegin()); - return *--it; + if (it > posixTrans.cbegin()) + return *--it; + // else: it fell between the last transition and the first of the POSIX rule. + return dataForTzTransition(m_tranTimes.last()); } // Otherwise if we can find a valid tran then use its rule |