forked from mirrors/linphone-iphone
Fix crash in conversationModel.getChatRoomSubject when avatarListModel is null
This commit is contained in:
parent
acdd201bbe
commit
7ae256b566
1 changed files with 23 additions and 17 deletions
|
|
@ -225,23 +225,29 @@ class ConversationModel: ObservableObject, Identifiable {
|
||||||
|
|
||||||
let addressTmp = addressFriend?.address?.asStringUriOnly() ?? ""
|
let addressTmp = addressFriend?.address?.asStringUriOnly() ?? ""
|
||||||
|
|
||||||
let avatarModelTmp = addressFriend != nil && !self.isGroup
|
let avatarModelTmp: ContactAvatarModel
|
||||||
? ContactsManager.shared.avatarListModel.first(where: {
|
if let addressFriend = addressFriend, !self.isGroup {
|
||||||
$0.friend!.name == addressFriend!.name
|
if let existingAvatarModel = ContactsManager.shared.avatarListModel.first(where: {
|
||||||
&& $0.friend!.address!.asStringUriOnly() == addressFriend!.address!.asStringUriOnly()
|
$0.friend?.name == addressFriend.name &&
|
||||||
})
|
$0.friend?.address?.asStringUriOnly() == addressFriend.address?.asStringUriOnly()
|
||||||
?? ContactAvatarModel(
|
}) {
|
||||||
friend: nil,
|
avatarModelTmp = existingAvatarModel
|
||||||
name: subjectTmp,
|
} else {
|
||||||
address: addressTmp,
|
avatarModelTmp = ContactAvatarModel(
|
||||||
withPresence: false
|
friend: nil,
|
||||||
)
|
name: subjectTmp,
|
||||||
: ContactAvatarModel(
|
address: addressTmp,
|
||||||
friend: nil,
|
withPresence: false
|
||||||
name: subjectTmp,
|
)
|
||||||
address: self.chatRoom.peerAddress?.asStringUriOnly() ?? addressTmp,
|
}
|
||||||
withPresence: false
|
} else {
|
||||||
)
|
avatarModelTmp = ContactAvatarModel(
|
||||||
|
friend: nil,
|
||||||
|
name: subjectTmp,
|
||||||
|
address: self.chatRoom.peerAddress?.asStringUriOnly() ?? addressTmp,
|
||||||
|
withPresence: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
var participantsAddressTmp: [String] = []
|
var participantsAddressTmp: [String] = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue