diff options
Diffstat (limited to 'Swiften/Avatars/AvatarManagerImpl.cpp')
-rw-r--r-- | Swiften/Avatars/AvatarManagerImpl.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Swiften/Avatars/AvatarManagerImpl.cpp b/Swiften/Avatars/AvatarManagerImpl.cpp index 7c3baa7..3aaae33 100644 --- a/Swiften/Avatars/AvatarManagerImpl.cpp +++ b/Swiften/Avatars/AvatarManagerImpl.cpp @@ -41,23 +41,25 @@ AvatarManagerImpl::~AvatarManagerImpl() { } boost::filesystem::path AvatarManagerImpl::getAvatarPath(const JID& jid) const { - std::string hash = combinedAvatarProvider.getAvatarHash(jid); - if (!hash.empty()) { - return avatarStorage->getAvatarPath(hash); + boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid); + if (hash && !hash->empty()) { + return avatarStorage->getAvatarPath(*hash); } return boost::filesystem::path(); } ByteArray AvatarManagerImpl::getAvatar(const JID& jid) const { - std::string hash = combinedAvatarProvider.getAvatarHash(jid); - if (!hash.empty()) { - return avatarStorage->getAvatar(hash); + boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid); + if (hash && !hash->empty()) { + return avatarStorage->getAvatar(*hash); } return ByteArray(); } void AvatarManagerImpl::handleCombinedAvatarChanged(const JID& jid) { - offlineAvatarManager->setAvatar(jid, combinedAvatarProvider.getAvatarHash(jid)); + boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid); + assert(hash); + offlineAvatarManager->setAvatar(jid, *hash); onAvatarChanged(jid); } |