Skip to content

Commit 3bc3f52

Browse files
committed
[processing] skip invalid geometries when buffering (fix #13763)
1 parent 0c02f18 commit 3bc3f52

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python/plugins/processing/algs/qgis/Buffer.py

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
__revision__ = '$Format:%H$'
2727

2828
from qgis.core import QgsFeature, QgsGeometry
29+
30+
from processing.core.ProcessingLog import ProcessingLog
2931
from processing.tools import vector
3032

3133

@@ -55,6 +57,9 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve,
5557
value = distance
5658

5759
inGeom = QgsGeometry(inFeat.geometry())
60+
if inGeom.isGeosEmpty() or not inGeom.isGeosValid():
61+
ProcessingLog.addToLog('Feature {} has empty or invalid geometry. Skipping...'.format(inFeat.id()), ProcessingLog.LOG_WARNING)
62+
continue
5863
outGeom = inGeom.buffer(float(value), segments)
5964
if first:
6065
tempGeom = QgsGeometry(outGeom)
@@ -77,6 +82,10 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve,
7782
else:
7883
value = distance
7984
inGeom = QgsGeometry(inFeat.geometry())
85+
if inGeom.isGeosEmpty() or not inGeom.isGeosValid():
86+
ProcessingLog.addToLog('Feature {} has empty or invalid geometry. Skipping...'.format(inFeat.id()), ProcessingLog.LOG_WARNING)
87+
continue
88+
8089
outGeom = inGeom.buffer(float(value), segments)
8190
outFeat.setGeometry(outGeom)
8291
outFeat.setAttributes(attrs)

0 commit comments

Comments
 (0)