Fix Refactor Fields error if layer has no features

This commit is contained in:
Borys Jurgiel 2017-04-06 10:14:01 +02:00
parent a30cf2923c
commit e5d10b6946

View File

@ -153,6 +153,7 @@ class FieldsMapper(GeoAlgorithm):
inFeat = QgsFeature()
outFeat = QgsFeature()
features = vector.features(layer)
if len(features):
total = 100.0 / len(features)
for current, inFeat in enumerate(features):
rownum = current + 1
@ -177,6 +178,8 @@ class FieldsMapper(GeoAlgorithm):
writer.addFeature(outFeat)
feedback.setProgress(int(current * total))
else:
feedback.setProgress(100)
del writer