Skip to content

Commit 99ff44c

Browse files
committedAug 28, 2014
Merge pull request #1564 from anitagraser/patch-2
[processing] check if value is None before trying to cast float
2 parents 6130505 + 75b3464 commit 99ff44c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
 

‎python/plugins/processing/algs/qgis/ftools/BasicStatisticsNumbers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ def processAlgorithm(self, progress):
104104
total = 100.0 / float(count)
105105
current = 0
106106
for ft in features:
107-
value = float(ft.attributes()[index])
108-
if isFirst:
109-
minValue = value
110-
maxValue = value
111-
isFirst = False
112-
else:
113-
if value < minValue:
107+
if ft.attributes()[index]:
108+
value = float(ft.attributes()[index])
109+
if isFirst:
114110
minValue = value
115-
if value > maxValue:
116111
maxValue = value
112+
isFirst = False
113+
else:
114+
if value < minValue:
115+
minValue = value
116+
if value > maxValue:
117+
maxValue = value
117118

118119
values.append(value)
119120
sumValue += value

0 commit comments

Comments
 (0)
Please sign in to comment.