# HG changeset patch # User Paul Aurich # Date 1240710154 0 # Node ID a25d09019b9b30adeb8700a85d7eb09db0b2baff # Parent 17379effc4177c3cf47b76a94917232919b1d8f2 xmlCtxtGetLastError may return NULL, especially with other misbehaving libraries in our address space. References #8136. diff -r 17379effc417 -r a25d09019b9b libpurple/protocols/jabber/parser.c --- a/libpurple/protocols/jabber/parser.c Sun Apr 26 00:30:02 2009 +0000 +++ b/libpurple/protocols/jabber/parser.c Sun Apr 26 01:42:34 2009 +0000 @@ -232,8 +232,17 @@ xmlParseChunk(js->context, "", 0, 0); } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { xmlError *err = xmlCtxtGetLastError(js->context); + /* + * libxml2 uses a global setting to determine whether or not to store + * warnings. Other libraries may set this, which causes err to be + * NULL. See #8136 for details. + */ + xmlErrorLevel level = XML_ERR_WARNING; - switch (err->level) { + if (err) + level = err->level; + + switch (level) { case XML_ERR_NONE: purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); break;