aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_vcard_legacy.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-01 23:42:33 +0200
committerKim Alvefur <zash@zash.se>2018-09-01 23:42:33 +0200
commitac72eeee52479dda94470328fe1239a95f1fec1a (patch)
tree8501a9bc59ab5bdd47fbec2a679033978b4f94cb /plugins/mod_vcard_legacy.lua
parent90718419362cc8b3e29c76301f0a92e92e7cd5c7 (diff)
downloadprosody-ac72eeee52479dda94470328fe1239a95f1fec1a.tar.gz
prosody-ac72eeee52479dda94470328fe1239a95f1fec1a.zip
mod_vcard_legacy: Handle incomplete avatar info
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r--plugins/mod_vcard_legacy.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index 7a34e68d..ea6563ed 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -107,11 +107,15 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event)
for _, hash in ipairs(avatar_meta) do
local meta = avatar_meta[hash];
local data = avatar_data[hash];
- local info = meta.tags[1]:get_child("info");
- vcard_temp:tag("PHOTO")
- :text_tag("TYPE", info and info.attr.type)
- :text_tag("BINVAL", data.tags[1]:get_text())
- :up();
+ local info = meta and meta.tags[1]:get_child("info");
+ vcard_temp:tag("PHOTO");
+ if info and info.attr.type then
+ vcard_temp:text_tag("TYPE", info.attr.type);
+ end
+ if data then
+ vcard_temp:text_tag("BINVAL", data.tags[1]:get_text());
+ end
+ vcard_temp:up();
end
end