From b39d4641a7c8395e828a93f341f868ae2fa7cab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Alexandrovi=C4=8D?= Date: Wed, 27 Nov 2024 20:22:42 +0100 Subject: [PATCH] Fix crash when search term is cleared. --- src/todo/search.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/todo/search.rs b/src/todo/search.rs index 20169a7..94556aa 100644 --- a/src/todo/search.rs +++ b/src/todo/search.rs @@ -85,10 +85,7 @@ impl<'a, 'b> Iterator for SearchMatches<'a, 'b> { fn next(&mut self) -> Option { self.act = match self.act { - Some(i) => match self.subject[i + 1..].find(self.to_search.deref()) { - Some(index) => Some(i + 1 + index), - None => return None, - }, + Some(i) => Some(i + 1 + self.subject.get(i + 1..)?.find(self.to_search.deref())?), None => self.subject.find(self.to_search.deref()), }; self.act