aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/stanza.lua24
1 files changed, 13 insertions, 11 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index a4fd0f82..6bc70ab9 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -122,21 +122,23 @@ end
function deserialize(stanza)
-- Set metatable
- setmetatable(stanza, stanza_mt);
- for _, child in ipairs(stanza) do
- if type(child) == "table" then
- deserialize(child);
- end
- end
- if not stanza.tags then
- -- Rebuild tags
- local tags = {};
+ if stanza then
+ setmetatable(stanza, stanza_mt);
for _, child in ipairs(stanza) do
if type(child) == "table" then
- t_insert(tags, child);
+ deserialize(child);
+ end
+ end
+ if not stanza.tags then
+ -- Rebuild tags
+ local tags = {};
+ for _, child in ipairs(stanza) do
+ if type(child) == "table" then
+ t_insert(tags, child);
+ end
end
+ stanza.tags = tags;
end
- stanza.tags = tags;
end
return stanza;