element-hq / element-hq/element-ios
Crashes When Changing "Show Bubbles" Setting, Only On iPad
- Dominant language
- Swift
- Stars
- 1.8k
- Forks
- 544
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
1. When using Element on an iPad
2. Browse to a room (the crash only happens while the room is visible)
3. Open the User Settings pane on the left
4. Scroll down to the Timeline section (at the bottom)
5. Toggle the "Message Bubbles" slider
6. The chat window clears, with a "Select a room" banner at the top of the screen
7. Tap on the "Select a room" banner
8. App will crash
https://user-images.githubusercontent.com/13354341/202215146-7c61b69c-6446-471e-8d9e-8f781a763c08.mov
### Outcome
#### What did you expect?
Channels would re-render with selected Bubbles setting.
#### What happened instead?
App crashed.
Xcode reports that the crash is at (linked to the version I'm testing locally):
https://github.com/vector-im/element-ios/blob/v1.9.9/Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift#L36
`
private var viewData: RoomInfoListViewData {
let encryptionImage = EncryptionTrustLevelBadgeImageHelper.roomBadgeImage(for: room.summary.roomEncryptionTrustLevel())
let directUserPresence = session.user(withUserId: room.directUserId)?.presence ?? .unknown
`
Riot/RoomInfoListViewModel.swift:36: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value (debugger pointing at room.summary as being nil).
### Your phone model
iPad Mini (6th Generation) (Emulator)
### Operating system version
iOS16.1 (20B72)
### Application version
1.9.9
### Homeserver
Synapse
### Will you send logs?
No
Contributor guide
Research direction
Start with Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift at line 36, then reproduce the issue on the listed iPad and iOS version by toggling Message Bubbles while a room is visible. Check the state used when the Select a room banner is tapped. Done means the channels re-render with the selected setting without crashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100