From 4720eea24f8fa382c778ecf28dd0e98a2c43c1d3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 24 Mar 2021 00:48:02 +0100 Subject: util.datamapper: Don't include empty unwrapped arrays Since there is no way to distinguish an empty such array from a zero-length array. Dropping it seems like the least annoying thing to do. --- teal-src/util/datamapper.tl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'teal-src/util') diff --git a/teal-src/util/datamapper.tl b/teal-src/util/datamapper.tl index 99431f86..ed7ce62c 100644 --- a/teal-src/util/datamapper.tl +++ b/teal-src/util/datamapper.tl @@ -168,7 +168,10 @@ function parse_object (schema : schema_t, s : st.stanza_t) : { string : any } out[prop] = parse_object(propschema, c); end elseif proptype == "array" then - out[prop] = parse_array(propschema, s); + local a = parse_array(propschema, s); + if a and a[1] ~= nil then + out[prop] = a; + end else error "unreachable" end -- cgit v1.2.3