Skip to content

Commit

Permalink
Fix crash when search term is cleared.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanteria committed Nov 27, 2024
1 parent dc6d02c commit e1c086e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/todo/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ impl<'a, 'b> Iterator for SearchMatches<'a, 'b> {

fn next(&mut self) -> Option<usize> {
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
Expand Down

0 comments on commit e1c086e

Please sign in to comment.