Changeset

5693:ef490e9276df

util.dataforms: Return nil for empty list-mutli responses, to be consistent with other readers
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 14 Jun 2013 00:07:57 +0200
parents 5682:e7b9ba2d0638
children 5694:7aec065d78a0 5699:e9f5384f5ff1
files util/dataforms.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/dataforms.lua	Thu Jun 13 13:56:35 2013 +0100
+++ b/util/dataforms.lua	Fri Jun 14 00:07:57 2013 +0200
@@ -187,7 +187,11 @@
 		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"] =