From ba8d1325ad50dad43f7c0913f9e97d5fad4149b0 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 5 May 2014 22:01:27 +0100 Subject: [PATCH] Added null check for presence error stanza namespace element Issue #341 --- src/xmpp/presence.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 19ab3c03..7969f0c0 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -336,7 +336,10 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); xmpp_stanza_t *error_stanza = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ERROR); xmpp_stanza_t *x = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_X); - char *xmlns = xmpp_stanza_get_ns(x); + char *xmlns = NULL; + if (x != NULL) { + xmlns = xmpp_stanza_get_ns(x); + } char *type = NULL; if (error_stanza != NULL) { type = xmpp_stanza_get_attribute(error_stanza, STANZA_ATTR_TYPE);