summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-08-28 14:44:32 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-08-28 14:44:32 (GMT)
commit5dc7d1459b966ba5b848760bc43cbb1242d5da80 (patch)
tree140c78dc162b79f0f01bb6358d8d645f16e9df98 /Swiften/Avatars/VCardAvatarManager.cpp
parentd5a0dcb28c5738660ee56483ad305a0075f71799 (diff)
parenteba9a50f10082430c38b849b6af95f92f3de6ef8 (diff)
downloadswift-contrib-5dc7d1459b966ba5b848760bc43cbb1242d5da80.zip
swift-contrib-5dc7d1459b966ba5b848760bc43cbb1242d5da80.tar.bz2
Merge branch 'swift-1.x'
* swift-1.x: Keep VCard photo hash cache consistent. Fix assertion on inconsistent VCard photohash cache. Conflicts: Swift/Controllers/Storages/VCardFileStorage.cpp Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
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;