Mercurial > pidgin
comparison libpurple/protocols/jabber/parser.c @ 26687:a25d09019b9b
xmlCtxtGetLastError may return NULL, especially with other misbehaving
libraries in our address space.
References #8136.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 26 Apr 2009 01:42:34 +0000 |
parents | 90d5e3b94a37 |
children | cd78ea46e9bd |
comparison
equal
deleted
inserted
replaced
26686:17379effc417 | 26687:a25d09019b9b |
---|---|
230 * parser, so do a ParseChunk right afterwards to force it. */ | 230 * parser, so do a ParseChunk right afterwards to force it. */ |
231 js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); | 231 js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); |
232 xmlParseChunk(js->context, "", 0, 0); | 232 xmlParseChunk(js->context, "", 0, 0); |
233 } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { | 233 } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { |
234 xmlError *err = xmlCtxtGetLastError(js->context); | 234 xmlError *err = xmlCtxtGetLastError(js->context); |
235 | 235 /* |
236 switch (err->level) { | 236 * libxml2 uses a global setting to determine whether or not to store |
237 * warnings. Other libraries may set this, which causes err to be | |
238 * NULL. See #8136 for details. | |
239 */ | |
240 xmlErrorLevel level = XML_ERR_WARNING; | |
241 | |
242 if (err) | |
243 level = err->level; | |
244 | |
245 switch (level) { | |
237 case XML_ERR_NONE: | 246 case XML_ERR_NONE: |
238 purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); | 247 purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); |
239 break; | 248 break; |
240 case XML_ERR_WARNING: | 249 case XML_ERR_WARNING: |
241 purple_debug_warning("jabber", "xmlParseChunk returned warning %i\n", ret); | 250 purple_debug_warning("jabber", "xmlParseChunk returned warning %i\n", ret); |