Software /
code /
prosody
Changeset
11464:6e25409fecbd
util.datamapper: Only get element name if there's an element
Fixes error due to attempting to index a nil value
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 19 Mar 2021 19:07:25 +0100 |
parents | 11463:21523e3d395e |
children | 11465:19a88b61ab4e |
files | teal-src/util/datamapper.tl util/datamapper.lua |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/teal-src/util/datamapper.tl Fri Mar 19 15:51:38 2021 +0100 +++ b/teal-src/util/datamapper.tl Fri Mar 19 19:07:25 2021 +0100 @@ -138,7 +138,9 @@ else c = s:get_child(nil, namespace); end - value = c.name; + if c is st.stanza_t then + value = c.name; + end elseif value_where == "in_attribute" then local attr = name if prefix then
--- a/util/datamapper.lua Fri Mar 19 15:51:38 2021 +0100 +++ b/util/datamapper.lua Fri Mar 19 19:07:25 2021 +0100 @@ -105,7 +105,9 @@ else c = s:get_child(nil, namespace); end - value = c.name; + if type(c) == "table" then + value = c.name; + end elseif value_where == "in_attribute" then local attr = name if prefix then