Software /
code /
prosody
Changeset
838:1035846d6273
core.xmlhandlers: Optimise completed stanza logic
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 26 Feb 2009 02:26:30 +0000 |
parents | 837:86d14e7ef60c |
children | 839:c45b5072f773 |
files | core/xmlhandlers.lua |
diffstat | 1 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/core/xmlhandlers.lua Thu Feb 26 02:24:12 2009 +0000 +++ b/core/xmlhandlers.lua Thu Feb 26 02:26:30 2009 +0000 @@ -121,17 +121,19 @@ 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;