summaryrefslogtreecommitdiff
path: root/src/positioning
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-10-24 09:21:15 +0200
committerAlex Blasche <alexander.blasche@qt.io>2018-10-24 08:25:31 +0000
commit6b109d09982e09940dc8e777430a04410d7b6550 (patch)
treef32047f399643ff7a175f818423f93468f2777cf /src/positioning
parentf9a1c4a18a3421617e28d2c26d30b011d22a0229 (diff)
downloadqtlocation-6b109d09982e09940dc8e777430a04410d7b6550.tar.gz
Fix crash when calling QGeoPath::length on empty QGeoPath instance
Fixes: QTBUG-71355 Change-Id: I47b058891a47cd6d020c4e192d40233c57814313 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/positioning')
-rw-r--r--src/positioning/qgeopath.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp
index 94a14ad1..d86f6d0c 100644
--- a/src/positioning/qgeopath.cpp
+++ b/src/positioning/qgeopath.cpp
@@ -464,6 +464,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;