1
0
Fork 0
mirror of https://github.com/bjc/prosody.git synced 2025-04-06 14:47:37 +03:00

tools/ejabberd2prosody: Don't throw an error if XML CDATA is null ([] in Erlang, instead of a string or being missing).

This commit is contained in:
Waqas Hussain 2014-02-18 16:03:13 -05:00
parent 23a72948e9
commit 9b804fffc8

View file

@ -44,8 +44,10 @@ function build_stanza(tuple, stanza)
for _, a in ipairs(tuple[4]) do build_stanza(a, stanza); end
if up then stanza:up(); else return stanza end
elseif tuple[1] == "xmlcdata" then
assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2]));
stanza:text(tuple[2]);
if type(tuple[2]) ~= "table" then
assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2]));
stanza:text(tuple[2]);
end -- else it's [], i.e., the null value, used for the empty string
else
error("unknown element type: "..serialize(tuple));
end