diff --git a/src/MatrixEventHandler.c b/src/MatrixEventHandler.c index 32050dd..17a3bb9 100644 --- a/src/MatrixEventHandler.c +++ b/src/MatrixEventHandler.c @@ -358,6 +358,10 @@ GetXMPPInformation(ParseeData *data, HashMap *event, char **from, char **to) static void ParseeMessageHandler(ParseeData *data, HashMap *event) { + if (!data || !event) + { + return; + } XMPPComponent *jabber = data->jabber; StanzaBuilder *builder = NULL; DbRef *ref = NULL; diff --git a/src/Parsee/Utils/Formatting.c b/src/Parsee/Utils/Formatting.c index 44e255a..dc7b1a6 100644 --- a/src/Parsee/Utils/Formatting.c +++ b/src/Parsee/Utils/Formatting.c @@ -58,7 +58,7 @@ XMPPifyElement(const ParseeConfig *conf, HashMap *event, XMLElement *elem, XMPPF } \ } \ while (0) - switch (elem->type) + switch (elem ? elem->type : -1) { case XML_ELEMENT_DATA: Concat(elem->data); @@ -155,7 +155,7 @@ XMPPifyElement(const ParseeConfig *conf, HashMap *event, XMLElement *elem, XMPPF { char *href = HashMapGet(elem->attrs, "href"); Uri *pref = UriParse(href); - if (StrEquals(pref->host, "matrix.to")) + if (pref && StrEquals(pref->host, "matrix.to")) { /* TODO: Check if the element here is a Matrix.TO * pointing to a Parsee user. */