Skip to content

Commit 30c663e

Browse files
committedSep 7, 2017
Fix calculation with null strings
1 parent 3086619 commit 30c663e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎python/plugins/processing/algs/qgis/StatisticsByCategories.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,13 @@ def addField(name):
158158
continue
159159
else:
160160
value = float(attrs[value_field_index])
161+
elif field_type == 'string':
162+
if attrs[value_field_index] == NULL:
163+
value=''
164+
else:
165+
value = str(attrs[value_field_index])
161166
elif attrs[value_field_index] == NULL:
162167
value = NULL
163-
elif field_type == 'string':
164-
value = str(attrs[value_field_index])
165168
else:
166169
value = attrs[value_field_index]
167170
cat = tuple([attrs[c] for c in category_field_indexes])

0 commit comments

Comments
 (0)
Please sign in to comment.