diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-03 04:56:05 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-04 04:25:47 (GMT) |
commit | f01e2a5024db69913aed016e2854b2589ca85080 (patch) | |
tree | 3429cb4e32e692d7ea031f92db694dbcf25d0242 /tests/auto | |
parent | b9b3ced2eafe13e491d5af5ad7432733941bfd8d (diff) | |
download | Qt-f01e2a5024db69913aed016e2854b2589ca85080.zip Qt-f01e2a5024db69913aed016e2854b2589ca85080.tar.gz Qt-f01e2a5024db69913aed016e2854b2589ca85080.tar.bz2 |
Remove Q_ASSERT from qtesselator autotest
If the test data is incorrect, print a meaningful warning into the test
output instead of deferencing an iterator beyond the last element in
the list.
Change-Id: I7be4f282639453de6d8240a2f17253025b415337
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtessellator/dataparser.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/qtessellator/dataparser.cpp b/tests/auto/qtessellator/dataparser.cpp index bd17ee2..d6566cb2 100644 --- a/tests/auto/qtessellator/dataparser.cpp +++ b/tests/auto/qtessellator/dataparser.cpp @@ -98,8 +98,12 @@ static QList<QPointF> parsePoints(const QByteArray &line) QList<qreal> nums = parseNumbersList(it); QList<qreal>::const_iterator nitr; for (nitr = nums.begin(); nitr != nums.end(); ++nitr) { - qreal x = *nitr; ++nitr; - Q_ASSERT(nitr != nums.end()); + qreal x = *nitr; + ++nitr; + if (nitr == nums.end()) { + qWarning() << "parsePoints: Even number of co-ordinates required, odd number found: skipping last point"; + break; + } qreal y = *nitr; res.append(QPointF(x, y)); } |