From c0a069904d6dd1495084e4c69dd639dad14fdedd Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 20 Oct 2017 11:38:17 -0700 Subject: Check if coordinates are non-empty before repeating the first entry Task-number: QTBUG-63926 Change-Id: Ic57090dbc78705893280e040e5b4556cf296f949 Reviewed-by: Paolo Angelelli --- src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp index 69bb6e4b..a4d3ed64 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)); -- cgit v1.2.1