Skip to content

Commit

Permalink
[processing] avoid division by zero (fix #15521)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 12, 2016
1 parent 6605a22 commit 898addf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/plugins/processing/algs/qgis/ConcaveHull.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

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
Expand Down Expand Up @@ -73,7 +74,10 @@ def processAlgorithm(self, progress):
# 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:
Expand Down

0 comments on commit 898addf

Please sign in to comment.