From c30e7d7f7b309a5720138d886731d01246df6358 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 25 Mar 2015 13:56:04 +0100 Subject: [PATCH] Detect correctly when vCard does not exist (#21) --- mod_admin_extra/src/mod_admin_extra.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mod_admin_extra/src/mod_admin_extra.erl b/mod_admin_extra/src/mod_admin_extra.erl index f04e6a1..fb8a5df 100644 --- a/mod_admin_extra/src/mod_admin_extra.erl +++ b/mod_admin_extra/src/mod_admin_extra.erl @@ -976,8 +976,9 @@ get_vcard_content(User, Server, Data) -> JID = jlib:make_jid(User, Server, get_module_resource(Server)), IQ = #iq{type = get, xmlns = ?NS_VCARD}, IQr = Module:Function(JID, JID, IQ), - case IQr#iq.sub_el of - [A1] -> + [A1] = IQr#iq.sub_el, + case A1#xmlel.children of + [_] -> case get_vcard(Data, A1) of [false] -> throw(error_no_value_found_in_vcard); ElemList -> [xml:get_tag_cdata(Elem) || Elem <- ElemList]