Fix crashes during logout.

This commit is contained in:
Stefan Ceriu
2026-06-18 14:14:26 +03:00
parent 6a381dcef0
commit 9a6f7595e5
2 changed files with 33 additions and 1 deletions
@@ -281,7 +281,11 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
let roomDetails = await fetchRoomDetails(from: room)
guard let roomInfo = roomDetails.roomInfo else {
fatalError("Missing room info for \(room.id())")
// The room info can be momentarily unavailable while the client tears down (e.g. on logout),
// where the SDK still delivers a diff but `room.roomInfo()` throws. Return a placeholder to
// keep the diff indices aligned with the SDK instead of crashing.
MXLog.error("Missing room info for \(room.id())")
return .placeholder(room: room)
}
var attributedLastMessage: AttributedString?