@@ -92,6 +92,9 @@ def processAlgorithm(self, progress):
9292 for i , clip_geom in enumerate (clip_geoms ):
9393 input_features = [f for f in vector .features (source_layer , QgsFeatureRequest ().setFilterRect (clip_geom .boundingBox ()))]
9494
95+ if not input_features :
96+ continue
97+
9598 if single_clip_feature :
9699 total = 100.0 / len (input_features )
97100 else :
@@ -116,11 +119,16 @@ def processAlgorithm(self, progress):
116119 if new_geom .wkbType () == QGis .WKBUnknown or QgsWKBTypes .flatType (new_geom .geometry ().wkbType ()) == QgsWKBTypes .GeometryCollection :
117120 int_com = in_feat .constGeometry ().combine (new_geom )
118121 int_sym = in_feat .constGeometry ().symDifference (new_geom )
119- new_geom = int_com .difference (int_sym )
120- if new_geom .isGeosEmpty () or not new_geom .isGeosValid ():
122+ if not int_com or not int_sym :
121123 ProcessingLog .addToLog (ProcessingLog .LOG_ERROR ,
122124 self .tr ('GEOS geoprocessing error: One or more '
123125 'input features have invalid geometry.' ))
126+ else :
127+ new_geom = int_com .difference (int_sym )
128+ if new_geom .isGeosEmpty () or not new_geom .isGeosValid ():
129+ ProcessingLog .addToLog (ProcessingLog .LOG_ERROR ,
130+ self .tr ('GEOS geoprocessing error: One or more '
131+ 'input features have invalid geometry.' ))
124132 else :
125133 # clip geometry totally contains feature geometry, so no need to perform intersection
126134 new_geom = QgsGeometry (in_feat .constGeometry ())
0 commit comments