summaryrefslogtreecommitdiff
path: root/src/mod_client_state.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-10-06 21:48:54 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-10-06 21:48:54 +0300
commit6efdd0f3504c4747748211d8379dfc9df6a710bc (patch)
tree828d108c2849152d30a7f6111ecc5f75f13cd7c6 /src/mod_client_state.erl
parentUpdate French translation (diff)
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
Diffstat (limited to '')
-rw-r--r--src/mod_client_state.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mod_client_state.erl b/src/mod_client_state.erl
index 21556db3..f7adb1c6 100644
--- a/src/mod_client_state.erl
+++ b/src/mod_client_state.erl
@@ -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;