aboutsummaryrefslogtreecommitdiffstats
path: root/core/xmlhandlers.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-02-26 02:26:30 +0000
committerMatthew Wild <mwild1@gmail.com>2009-02-26 02:26:30 +0000
commit2aa35ba40d4868d6e65f07b743b269c89d6b0e46 (patch)
treedc2b8d93d89af492a49612fbeaca3cd37acdb805 /core/xmlhandlers.lua
parentd0072c9cfab3365c0fe5f8f3bfda87be899c8e13 (diff)
downloadprosody-2aa35ba40d4868d6e65f07b743b269c89d6b0e46.tar.gz
prosody-2aa35ba40d4868d6e65f07b743b269c89d6b0e46.zip
core.xmlhandlers: Optimise completed stanza logic
Diffstat (limited to 'core/xmlhandlers.lua')
-rw-r--r--core/xmlhandlers.lua24
1 files changed, 13 insertions, 11 deletions
diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua
index 020e08db..56115917 100644
--- a/core/xmlhandlers.lua
+++ b/core/xmlhandlers.lua
@@ -121,17 +121,19 @@ function init_xmlhandlers(session, stream_callbacks)
cb_error(session, "parse-error", "unexpected-element-close", name);
end
end
- if stanza and #chardata > 0 then
- -- We have some character data in the buffer
- stanza:text(t_concat(chardata));
- chardata = {};
- end
- -- Complete stanza
- if #stanza.last_add == 0 then
- cb_handlestanza(session, stanza);
- stanza = nil;
- else
- stanza:up();
+ if stanza then
+ if stanza and #chardata > 0 then
+ -- We have some character data in the buffer
+ stanza:text(t_concat(chardata));
+ chardata = {};
+ end
+ -- Complete stanza
+ if #stanza.last_add == 0 then
+ cb_handlestanza(session, stanza);
+ stanza = nil;
+ else
+ stanza:up();
+ end
end
end
return xml_handlers;