From 34e3e84eb40d0c8b117a63fe3e724ef680291156 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Thu, 25 Feb 2021 00:43:07 +0100 Subject: [PATCH] koffice: fix cass issue where only the first session would work --- apps/koffice/libko/src/cass/timeline.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/koffice/libko/src/cass/timeline.rs b/apps/koffice/libko/src/cass/timeline.rs index 057f0b47d7d..b9a2826de5c 100644 --- a/apps/koffice/libko/src/cass/timeline.rs +++ b/apps/koffice/libko/src/cass/timeline.rs @@ -41,14 +41,11 @@ impl Timeline { fn last_session(&mut self) -> Option<&mut Session> { self.inner .iter_mut() - .find(|e| match e { - Entry::Session(_) => true, - _ => false, - }) - .map(|e| match e { - Entry::Session(ref mut s) => s, - _ => unreachable!(), + .filter_map(|e| match e { + Entry::Session(s) => Some(s), + _ => None, }) + .last() } /// Utility function to get the last invoice in the timeline