Fix crash when connecting to some types of room
This commit is contained in:
parent
34bcf85236
commit
80dad00125
2 changed files with 12 additions and 1 deletions
|
|
@ -14,6 +14,10 @@ Procedure when bumping the version number:
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Crash when connecting to nonexistent rooms
|
||||||
|
- Crash when connecting to rooms that require authentication
|
||||||
|
|
||||||
## v0.2.1 - 2022-08-11
|
## v0.2.1 - 2022-08-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,19 @@ impl Rooms {
|
||||||
/// - failed connection attempts, or
|
/// - failed connection attempts, or
|
||||||
/// - rooms that were deleted from the db.
|
/// - rooms that were deleted from the db.
|
||||||
async fn stabilize_rooms(&mut self) {
|
async fn stabilize_rooms(&mut self) {
|
||||||
let rooms_set = self
|
let mut rooms_set = self
|
||||||
.vault
|
.vault
|
||||||
.euph_rooms()
|
.euph_rooms()
|
||||||
.await
|
.await
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<HashSet<_>>();
|
.collect::<HashSet<_>>();
|
||||||
|
|
||||||
|
// Prevent room that is currently being shown from being removed. This
|
||||||
|
// could otherwise happen when connecting to a room that doesn't exist.
|
||||||
|
if let State::ShowRoom(name) = &self.state {
|
||||||
|
rooms_set.insert(name.clone());
|
||||||
|
}
|
||||||
|
|
||||||
self.euph_rooms
|
self.euph_rooms
|
||||||
.retain(|n, r| !r.stopped() || rooms_set.contains(n));
|
.retain(|n, r| !r.stopped() || rooms_set.contains(n));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue