From 08d10991f514f8e04fd567397ba964f11b5548f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 4 Nov 2023 12:36:12 +0100 Subject: [PATCH] timeline: Fix iter type `GtkFlattenListModel`'s item type is always `GObject` --- src/session/model/room/timeline/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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; };