Remove Q_ASSERT from qtesselator autotest
authorJason McDonald <jason.mcdonald@nokia.com>
Tue, 3 May 2011 04:56:05 +0000 (14:56 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:43 +0000 (10:46 +1000)
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
(cherry picked from commit f01e2a5024db69913aed016e2854b2589ca85080)

tests/auto/qtessellator/dataparser.cpp

index bd17ee2..d6566cb 100644 (file)
@@ -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));
     }