# HG changeset patch # User Kim Alvefur # Date 1616177245 -3600 # Node ID 6e25409fecbd2d37b7f6dd913c27b42932033ddf # Parent 21523e3d395e0be7ef8b5f3235554c945f13b30e util.datamapper: Only get element name if there's an element Fixes error due to attempting to index a nil value diff -r 21523e3d395e -r 6e25409fecbd teal-src/util/datamapper.tl --- 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 diff -r 21523e3d395e -r 6e25409fecbd util/datamapper.lua --- 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