Prevent crashes creating contacts with only phone number and no SIP address
This commit is contained in:
parent
5d42559f83
commit
8003b09e3b
2 changed files with 4 additions and 3 deletions
|
|
@ -100,7 +100,7 @@ void MagicSearchModel::onSearchResultsReceived(const std::shared_ptr<linphone::M
|
|||
|
||||
auto resultIt =
|
||||
std::find_if(finalResults.begin(), finalResults.end(), [result](std::shared_ptr<linphone::SearchResult> r) {
|
||||
return r->getAddress()->weakEqual(result->getAddress());
|
||||
return r->getAddress() && r->getAddress()->weakEqual(result->getAddress());
|
||||
});
|
||||
if (resultIt == finalResults.end()) finalResults.push_back(result);
|
||||
else if (fList && fList->getDisplayName() == "app_friends") *resultIt = result; // replace if local friend
|
||||
|
|
@ -142,5 +142,5 @@ void MagicSearchModel::updateFriendListWithFriend(const std::shared_ptr<linphone
|
|||
}
|
||||
qDebug() << log().arg("Adding Friend:") << linphoneFriend.get();
|
||||
friendList->addFriend(linphoneFriend);
|
||||
emit CoreModel::getInstance()->friendCreated(linphoneFriend);
|
||||
emit CoreModel::getInstance() -> friendCreated(linphoneFriend);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,7 +364,8 @@ VariantObject *Utils::findAvatarByAddress(const QString &address) {
|
|||
});
|
||||
// Rebuild avatar if needed
|
||||
auto updateValue = [data, address](const std::shared_ptr<linphone::Friend> &f) -> void {
|
||||
if (f && f->getAddress()->weakEqual(ToolModel::interpretUrl(address))) data->invokeRequestValue();
|
||||
if (f && f->getAddress() && f->getAddress()->weakEqual(ToolModel::interpretUrl(address)))
|
||||
data->invokeRequestValue();
|
||||
};
|
||||
data->makeUpdateCond(CoreModel::getInstance().get(), &CoreModel::friendCreated, updateValue);
|
||||
data->makeUpdateCond(CoreModel::getInstance().get(), &CoreModel::friendRemoved, updateValue);
|
||||
|
|
|
|||
Loading…
Reference in a new issue