summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-10-30 09:45:30 +0100
committerLiang Qi <liang.qi@qt.io>2018-10-30 09:45:30 +0100
commit563f6eb62fc614d435bf29337e182d82131b5b87 (patch)
tree7e27a71eb96c0ba9079994d4336ec3348271557a
parenteb3143f22ca1642056d821b73af493cdab59dd85 (diff)
parent6b109d09982e09940dc8e777430a04410d7b6550 (diff)
downloadqtlocation-563f6eb62fc614d435bf29337e182d82131b5b87.tar.gz
Merge remote-tracking branch 'origin/5.11' into 5.12.0v5.12.0-beta4
Change-Id: I0f4a3b7bc7c5c7f8da5af631000a6d5156884efe
-rw-r--r--src/positioning/qgeopath.cpp3
-rw-r--r--tests/auto/qgeopath/tst_qgeopath.cpp1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp
index 35d82b5f..beb43692 100644
--- a/src/positioning/qgeopath.cpp
+++ b/src/positioning/qgeopath.cpp
@@ -483,6 +483,9 @@ void QGeoPathPrivate::setWidth(const qreal &width)
double QGeoPathPrivate::length(int indexFrom, int indexTo) const
{
+ if (path().isEmpty())
+ return 0.0;
+
bool wrap = indexTo == -1;
if (indexTo < 0 || indexTo >= path().size())
indexTo = path().size() - 1;
diff --git a/tests/auto/qgeopath/tst_qgeopath.cpp b/tests/auto/qgeopath/tst_qgeopath.cpp
index 97bf69fe..213af0ad 100644
--- a/tests/auto/qgeopath/tst_qgeopath.cpp
+++ b/tests/auto/qgeopath/tst_qgeopath.cpp
@@ -70,6 +70,7 @@ void tst_QGeoPath::defaultConstructor()
QGeoPath p;
QVERIFY(!p.path().size());
QCOMPARE(p.width(), qreal(0.0));
+ QCOMPARE(p.length(), double(0.0));
}
void tst_QGeoPath::listConstructor()