async_client: Don't assume that there are any state events.

master
Damir Jelić 2020-03-14 18:47:56 +01:00
parent 39dd9280cb
commit 70dda32949
2 changed files with 2 additions and 2 deletions

View File

@ -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 { for event in &room.timeline.events {

View File

@ -250,7 +250,7 @@ impl Client {
Ok(()) Ok(())
} }
fn get_or_create_room(&mut self, room_id: &str) -> &mut Arc<RwLock<Room>> { pub(crate) fn get_or_create_room(&mut self, room_id: &str) -> &mut Arc<RwLock<Room>> {
#[allow(clippy::or_fun_call)] #[allow(clippy::or_fun_call)]
self.joined_rooms self.joined_rooms
.entry(room_id.to_string()) .entry(room_id.to_string())