From 46d616526f7defdd072ea8432721617b02b597bb Mon Sep 17 00:00:00 2001 From: Pierre TILAK Date: Wed, 18 Sep 2019 14:35:12 +1200 Subject: [PATCH] Avoid a segfault, error handling --- src/QtLocationPlugin/QGCMapTileSet.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/QtLocationPlugin/QGCMapTileSet.cpp b/src/QtLocationPlugin/QGCMapTileSet.cpp index 340cbb53d..5e9aeb9a8 100644 --- a/src/QtLocationPlugin/QGCMapTileSet.cpp +++ b/src/QtLocationPlugin/QGCMapTileSet.cpp @@ -201,7 +201,15 @@ void QGCCachedTileSet::_doneWithDownload() _totalTileCount = _savedTileCount; _totalTileSize = _savedTileSize; //-- Too expensive to compute the real size now. Estimate it for the time being. - quint32 avg = _savedTileSize / _savedTileCount; + quint32 avg; + if(_savedTileSize != 0){ + avg = _savedTileSize / _savedTileCount; + } + else{ + qWarning() << "QGCMapEngineManager::_doneWithDownload _savedTileSize=0 !"; + avg = 0; + } + _uniqueTileSize = _uniqueTileCount * avg; } emit totalTileCountChanged(); -- 2.22.0