summaryrefslogtreecommitdiff
path: root/src/location
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-20 15:32:40 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-22 18:09:26 +0200
commit7c7248206907bcb0d65a4810ac5e52faf8da4ec8 (patch)
treee465adfd1ae501b98b30177076f97681f5a78643 /src/location
parentee7e5de79f83625df1adfb244b0d608dae480728 (diff)
downloadqtlocation-7c7248206907bcb0d65a4810ac5e52faf8da4ec8.tar.gz
GeoJSON: don't crash when operating on empty data
Fix crashes in "geojson_viewer" example when trying to print or store debug data without loading a file first. Change-Id: I7b2955d072af8d2a1f39bfca196ffc309e9b4234 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Diffstat (limited to 'src/location')
-rw-r--r--src/location/labs/qgeojson.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/location/labs/qgeojson.cpp b/src/location/labs/qgeojson.cpp
index 99e612d1..423615ad 100644
--- a/src/location/labs/qgeojson.cpp
+++ b/src/location/labs/qgeojson.cpp
@@ -1236,6 +1236,8 @@ static QString printQvariant(const QVariant v, int tabs = 0) {
readable form.
*/
QString toString(const QVariantList &geoData) {
+ if (geoData.isEmpty())
+ return QString();
return printQvariant(geoData.first(), 0);
}