Skip to content
Snippets Groups Projects
Commit 74214fd6 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

misc: cleanup some warnings

Change-Id: Iba7379b89e33525a86619241b74dbf82f3c07d7d
parent f5bc9288
No related branches found
No related tags found
No related merge requests found
......@@ -356,10 +356,8 @@ getAccountAvatar(const QString& accountId)
QString filePath;
filePath = accountLocalPath + "profile.vcf";
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Can't open file: " << filePath;
if (!file.open(QIODevice::ReadOnly))
return {};
}
const auto vCard = lrc::vCard::utils::toHashMap(file.readAll());
const auto photo = (vCard.find(vCard::Property::PHOTO_PNG) == vCard.end())
? vCard[vCard::Property::PHOTO_JPEG]
......@@ -384,7 +382,6 @@ buildContactFromProfile(const QString& accountId,
QString filePath = accountLocalPath + "profiles/" + peer_uri + ".vcf";
file.setFileName(filePath);
if (!file.open(QIODevice::ReadOnly)) {
qWarning().noquote() << "Can't open file: " << filePath;
return {profileInfo, "", true, false};
}
// rename it
......
......@@ -523,18 +523,15 @@ ContactModel::sendDhtMessage(const QString& contactUri, const QString& body) con
const QString
ContactModel::bestNameForContact(const QString& contactUri) const
{
try {
auto contact = getContact(contactUri);
std::lock_guard<std::mutex> lk(pimpl_->contactsMtx_);
if (pimpl_->contacts.contains(contactUri)) {
auto contact = pimpl_->contacts.value(contactUri);
auto alias = contact.profileInfo.alias.simplified();
if (alias.isEmpty()) {
return bestIdFromContactInfo(contact);
}
return alias;
} catch (const std::out_of_range& e) {
qDebug() << "ContactModel::bestNameForContact" << e.what();
}
return contactUri;
}
......@@ -547,13 +544,11 @@ ContactModel::avatar(const QString& uri) const
const QString
ContactModel::bestIdForContact(const QString& contactUri) const
{
try {
auto contact = getContact(contactUri);
std::lock_guard<std::mutex> lk(pimpl_->contactsMtx_);
if (pimpl_->contacts.contains(contactUri)) {
auto contact = pimpl_->contacts.value(contactUri);
return bestIdFromContactInfo(contact);
} catch (const std::out_of_range& e) {
qDebug() << "ContactModel::bestIdForContact" << e.what();
}
return contactUri;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment