From 75b3464e1cc0d50a6b0359f2bb0e71d87fe069b2 Mon Sep 17 00:00:00 2001 From: anitagraser Date: Thu, 28 Aug 2014 09:48:02 +0200 Subject: [PATCH] check if value is None before trying to cast float the tool used to fail when there were NULL values in the fields --- .../algs/qgis/ftools/BasicStatisticsNumbers.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/python/plugins/processing/algs/qgis/ftools/BasicStatisticsNumbers.py b/python/plugins/processing/algs/qgis/ftools/BasicStatisticsNumbers.py index 830fb9eac8a..9644040c96f 100644 --- a/python/plugins/processing/algs/qgis/ftools/BasicStatisticsNumbers.py +++ b/python/plugins/processing/algs/qgis/ftools/BasicStatisticsNumbers.py @@ -104,16 +104,17 @@ class BasicStatisticsNumbers(GeoAlgorithm): total = 100.0 / float(count) current = 0 for ft in features: - value = float(ft.attributes()[index]) - if isFirst: - minValue = value - maxValue = value - isFirst = False - else: - if value < minValue: + if ft.attributes()[index]: + value = float(ft.attributes()[index]) + if isFirst: minValue = value - if value > maxValue: maxValue = value + isFirst = False + else: + if value < minValue: + minValue = value + if value > maxValue: + maxValue = value values.append(value) sumValue += value