Detect correctly when vCard does not exist (#21)

This commit is contained in:
Badlop 2015-03-25 13:56:04 +01:00
parent 0c30beb93d
commit fbb6b65192
1 changed files with 3 additions and 2 deletions

View File

@ -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]