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>
This commit is contained in:
Edward Welbourne 2019-03-21 16:10:09 +01:00 committed by Tony Sarajärvi
parent 0211774c68
commit 1119cd4ece

View File

@ -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