From e599a7264dbbe8ce26c4cf9086f2edfc51c09461 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Fri, 14 Jun 2013 00:07:57 +0200 Subject: util.dataforms: Return nil for empty list-mutli responses, to be consistent with other readers --- util/dataforms.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util') 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"] = -- cgit v1.2.3