]> granicus.if.org Git - ejabberd/commitdiff
Detect correctly when vCard does not exist (#21)
authorBadlop <badlop@process-one.net>
Wed, 25 Mar 2015 12:56:04 +0000 (13:56 +0100)
committerBadlop <badlop@process-one.net>
Thu, 26 Mar 2015 13:00:58 +0000 (14:00 +0100)
src/mod_admin_extra.erl

index f04e6a19a018582332f1c46da49e7964d4a7d2af..fb8a5df96e8a4d5588b5bcf3a642317f08437977 100644 (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]