aboutsummaryrefslogtreecommitdiffstats
path: root/util/dataforms.lua
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2013-06-14 00:07:57 +0200
committerFlorian Zeitz <florob@babelmonkeys.de>2013-06-14 00:07:57 +0200
commit8533ff05282ec43eb0c2674e5d15569ef5652c38 (patch)
tree63509f834ee889507716628aca512b8187fbb922 /util/dataforms.lua
parent4923e58c2ff35388af1736f5d0666207553b57e4 (diff)
downloadprosody-8533ff05282ec43eb0c2674e5d15569ef5652c38.tar.gz
prosody-8533ff05282ec43eb0c2674e5d15569ef5652c38.zip
util.dataforms: Return nil for empty list-mutli responses, to be consistent with other readers
Diffstat (limited to 'util/dataforms.lua')
-rw-r--r--util/dataforms.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua
index 8634e337..52924841 100644
--- a/util/dataforms.lua
+++ b/util/dataforms.lua
@@ -187,7 +187,11 @@ field_readers["list-multi"] =
for value in field_tag:childtags("value") do
result[#result+1] = value:get_text();
end
- return result, (required and #result == 0 and "Required value missing" or nil);
+ if #result > 0 then
+ return result;
+ elseif required then
+ return nil, "Required value missing";
+ end
end
field_readers["text-multi"] =