summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-10-20 18:38:17 (GMT)
committerBruno de Oliveira Abinader <brunoabinader@gmail.com>2017-10-26 13:05:49 (GMT)
commitc0a069904d6dd1495084e4c69dd639dad14fdedd (patch)
tree3686ba15bcc751a321a3581263b6716dee717bc1
parent592c381564e3f12b79a3d5e9fec5aec2b8045742 (diff)
downloadqtlocation-c0a069904d6dd1495084e4c69dd639dad14fdedd.tar.gz
Check if coordinates are non-empty before repeating the first entry
Task-number: QTBUG-63926 Change-Id: Ic57090dbc78705893280e040e5b4556cf296f949 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
-rw-r--r--src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
index 69bb6e4..a4d3ed6 100644
--- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
+++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
@@ -124,7 +124,10 @@ QMapbox::Feature featureFromMapPolygon(QDeclarativePolygonMapItem *mapItem)
coordinates << QMapbox::Coordinate { coordinate.latitude(), coordinate.longitude() };
}
}
- coordinates.append(coordinates.first());
+
+ if (!coordinates.empty())
+ coordinates.append(coordinates.first()); // closing the path
+
QMapbox::CoordinatesCollections geometry { { coordinates } };
return QMapbox::Feature(QMapbox::Feature::PolygonType, geometry, {}, getId(mapItem));