Skip to content

Commit

Permalink
followup 1ac053f
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Apr 27, 2017
1 parent 1ac053f commit eeba0ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/qgis/SaveSelectedFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ def processAlgorithm(self, context, feedback):
writer = output.getVectorWriter(vectorLayer.fields(), vectorLayer.wkbType(), vectorLayer.crs(), context)

features = vectorLayer.getSelectedFeatures()
if len(features) == 0:
count = int(vectorLayer.selectedFeatureCount())
if count == 0:
raise GeoAlgorithmExecutionException(self.tr('There are no selected features in the input layer.'))

total = 100.0 / len(features)
total = 100.0 / count
for current, feat in enumerate(features):
writer.addFeature(feat)
feedback.setProgress(int(current * total))
Expand Down

0 comments on commit eeba0ef

Please sign in to comment.