mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-02 12:19:23 +00:00
try to fix crash in chatrooms
This commit is contained in:
parent
b79b324027
commit
d24cef5e17
2 changed files with 15 additions and 8 deletions
|
|
@ -49,12 +49,14 @@ ChatCore::ChatCore(const std::shared_ptr<linphone::ChatRoom> &chatRoom) : QObjec
|
|||
} else {
|
||||
if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) {
|
||||
auto participants = chatRoom->getParticipants();
|
||||
auto peer = participants.front();
|
||||
if (peer) mTitle = ToolModel::getDisplayName(peer->getAddress()->clone());
|
||||
mAvatarUri = ToolModel::getDisplayName(peer->getAddress()->clone());
|
||||
if (participants.size() == 1) {
|
||||
auto peerAddress = peer->getAddress();
|
||||
if (peerAddress) mPeerAddress = Utils::coreStringToAppString(peerAddress->asStringUriOnly());
|
||||
if (participants.size() > 0) {
|
||||
auto peer = participants.front();
|
||||
if (peer) mTitle = ToolModel::getDisplayName(peer->getAddress()->clone());
|
||||
mAvatarUri = ToolModel::getDisplayName(peer->getAddress()->clone());
|
||||
if (participants.size() == 1) {
|
||||
auto peerAddress = peer->getAddress();
|
||||
if (peerAddress) mPeerAddress = Utils::coreStringToAppString(peerAddress->asStringUriOnly());
|
||||
}
|
||||
}
|
||||
} else if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::Conference)) {
|
||||
mTitle = Utils::coreStringToAppString(chatRoom->getSubject());
|
||||
|
|
|
|||
|
|
@ -63,8 +63,13 @@ QString ChatModel::getTitle() {
|
|||
return ToolModel::getDisplayName(mMonitor->getPeerAddress()->clone());
|
||||
} else {
|
||||
if (mMonitor->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) {
|
||||
auto peer = mMonitor->getParticipants().front();
|
||||
return peer ? ToolModel::getDisplayName(peer->getAddress()->clone()) : "Chat";
|
||||
auto participants = mMonitor->getParticipants();
|
||||
if (participants.size() > 0) {
|
||||
auto peer = participants.front();
|
||||
return peer ? ToolModel::getDisplayName(peer->getAddress()->clone()) : "";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else if (mMonitor->hasCapability((int)linphone::ChatRoom::Capabilities::Conference)) {
|
||||
return Utils::coreStringToAppString(mMonitor->getSubject());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue