25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Don't crash when 'from' is undefined

c2s_filter_send hook may pass a stanza with undefined from/to (due to
legacy auth for example). Work around this problem.

Fixes #2036
This commit is contained in:
Evgeniy Khramtsov 2017-10-06 21:48:54 +03:00
parent 0ed210877a
commit 6efdd0f350

View File

@ -265,7 +265,10 @@ filter_other({Stanza, #{jid := JID} = C2SState} = Acc) when ?is_stanza(Stanza) -
Acc;
_ ->
?DEBUG("Won't add stanza for ~s to CSI queue", [jid:encode(JID)]),
From = xmpp:get_from(Stanza),
From = case xmpp:get_from(Stanza) of
undefined -> JID;
F -> F
end,
C2SState1 = dequeue_sender(From, C2SState),
{Stanza, C2SState1}
end;