From 70dda329490c336c158e5a26671dea82b786cf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Sat, 14 Mar 2020 18:47:56 +0100 Subject: [PATCH] async_client: Don't assume that there are any state events. --- src/async_client.rs | 2 +- src/base_client.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/async_client.rs b/src/async_client.rs index 7819fd0e..3aad1bee 100644 --- a/src/async_client.rs +++ b/src/async_client.rs @@ -400,7 +400,7 @@ impl AsyncClient { } } - client.joined_rooms.get(&room_id).unwrap().clone() + client.get_or_create_room(&room_id).clone() }; for event in &room.timeline.events { diff --git a/src/base_client.rs b/src/base_client.rs index eac2c2f9..8813ecef 100644 --- a/src/base_client.rs +++ b/src/base_client.rs @@ -250,7 +250,7 @@ impl Client { Ok(()) } - fn get_or_create_room(&mut self, room_id: &str) -> &mut Arc> { + pub(crate) fn get_or_create_room(&mut self, room_id: &str) -> &mut Arc> { #[allow(clippy::or_fun_call)] self.joined_rooms .entry(room_id.to_string())