diff --git a/src/session/model/room/timeline/mod.rs b/src/session/model/room/timeline/mod.rs index 92554069..19515fc8 100644 --- a/src/session/model/room/timeline/mod.rs +++ b/src/session/model/room/timeline/mod.rs @@ -434,8 +434,13 @@ impl Timeline { /// Get the position of the event with the given key in this `Timeline`. pub fn find_event_position(&self, key: &EventKey) -> Option { - for (pos, item) in self.items().iter::().enumerate() { - let Ok(item) = item else { + for (pos, item) in self + .items() + .iter::() + .map(|o| o.ok().and_downcast::()) + .enumerate() + { + let Some(item) = item else { break; };