summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Avatars/VCardAvatarManager.cpp')
-rw-r--r--Swiften/Avatars/VCardAvatarManager.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Swiften/Avatars/VCardAvatarManager.cpp b/Swiften/Avatars/VCardAvatarManager.cpp
index 84f94d5..c9571c3 100644
--- a/Swiften/Avatars/VCardAvatarManager.cpp
+++ b/Swiften/Avatars/VCardAvatarManager.cpp
@@ -34,8 +34,13 @@ std::string VCardAvatarManager::getAvatarHash(const JID& jid) const {
if (!hash.empty()) {
if (!avatarStorage_->hasAvatar(hash)) {
VCard::ref vCard = vcardManager_->getVCard(avatarJID);
- assert(vCard);
- avatarStorage_->addAvatar(hash, vCard->getPhoto());
+ if (vCard) {
+ avatarStorage_->addAvatar(hash, vCard->getPhoto());
+ }
+ else {
+ // Can happen if the cache is inconsistent.
+ hash = "";
+ }
}
}
return hash;