[FIX/WIP] Chrck URI before doing anything funny

This commit is contained in:
lda 2025-02-17 08:30:18 +00:00
commit c96f0486ff
2 changed files with 6 additions and 2 deletions

View file

@ -358,6 +358,10 @@ GetXMPPInformation(ParseeData *data, HashMap *event, char **from, char **to)
static void static void
ParseeMessageHandler(ParseeData *data, HashMap *event) ParseeMessageHandler(ParseeData *data, HashMap *event)
{ {
if (!data || !event)
{
return;
}
XMPPComponent *jabber = data->jabber; XMPPComponent *jabber = data->jabber;
StanzaBuilder *builder = NULL; StanzaBuilder *builder = NULL;
DbRef *ref = NULL; DbRef *ref = NULL;

View file

@ -58,7 +58,7 @@ XMPPifyElement(const ParseeConfig *conf, HashMap *event, XMLElement *elem, XMPPF
} \ } \
} \ } \
while (0) while (0)
switch (elem->type) switch (elem ? elem->type : -1)
{ {
case XML_ELEMENT_DATA: case XML_ELEMENT_DATA:
Concat(elem->data); Concat(elem->data);
@ -155,7 +155,7 @@ XMPPifyElement(const ParseeConfig *conf, HashMap *event, XMLElement *elem, XMPPF
{ {
char *href = HashMapGet(elem->attrs, "href"); char *href = HashMapGet(elem->attrs, "href");
Uri *pref = UriParse(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 /* TODO: Check if the element here is a Matrix.TO
* pointing to a Parsee user. */ * pointing to a Parsee user. */