diff --git a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallExt.kt b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallExt.kt index ef9ef3ef9a..ac9d169633 100644 --- a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallExt.kt +++ b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallExt.kt @@ -16,17 +16,20 @@ package im.vector.app.features.call.webrtc +import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem fun WebRtcCall.getOpponentAsMatrixItem(session: Session): MatrixItem? { - return session.getRoomSummary(nativeRoomId)?.let { roomSummary -> + return session.getRoom(nativeRoomId)?.let { room -> + val roomSummary = room.roomSummary() ?: return@let null // Fallback to RoomSummary if there is no other member. - if (roomSummary.otherMemberIds.isEmpty()) { + if (roomSummary.otherMemberIds.isEmpty().orFalse()) { roomSummary.toMatrixItem() } else { - roomSummary.otherMemberIds.first().let { session.getUser(it)?.toMatrixItem() } + val userId = roomSummary.otherMemberIds.first() + return room.getRoomMember(userId)?.toMatrixItem() } } }