aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ejabberd2prosody.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2014-02-18 16:03:13 -0500
committerWaqas Hussain <waqas20@gmail.com>2014-02-18 16:03:13 -0500
commitb86b759546e03111a42d2f32e9f2c562e794a8d3 (patch)
tree127a0949592aceb413a6daa2021c19593fcbf7de /tools/ejabberd2prosody.lua
parent72fd4f9f67821523290a90486665de70ba059ef8 (diff)
downloadprosody-b86b759546e03111a42d2f32e9f2c562e794a8d3.tar.gz
prosody-b86b759546e03111a42d2f32e9f2c562e794a8d3.zip
tools/ejabberd2prosody: Don't throw an error if XML CDATA is null ([] in Erlang, instead of a string or being missing).
Diffstat (limited to 'tools/ejabberd2prosody.lua')
-rwxr-xr-xtools/ejabberd2prosody.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/ejabberd2prosody.lua b/tools/ejabberd2prosody.lua
index be1504b2..d0675a65 100755
--- a/tools/ejabberd2prosody.lua
+++ b/tools/ejabberd2prosody.lua
@@ -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