[processing] avoid division by zero (fix #15521)

This commit is contained in:
Alexander Bruy 2016-10-12 16:04:31 +03:00
parent 6605a2274f
commit 898addfa33

View File

@ -28,6 +28,7 @@ __revision__ = '$Format:%H$'
from qgis.core import Qgis, QgsFeatureRequest, QgsFeature, QgsGeometry, QgsWkbTypes
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterNumber
from processing.core.parameters import ParameterBoolean
@ -73,7 +74,10 @@ class ConcaveHull(GeoAlgorithm):
# Get max edge length from Delaunay triangles
progress.setText(self.tr('Computing edges max length...'))
features = delaunay_layer.getFeatures()
counter = 50. / delaunay_layer.featureCount()
if len(features) == 0:
raise GeoAlgorithmExecutionException(self.tr('No Delaunay triangles created.'))
counter = 50. / len(features)
lengths = []
edges = {}
for feat in features: