From 27a007ad021c4b8d62b857a6e312a608d33b6cb0 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 21 Aug 2024 13:48:37 +0200 Subject: fix(select/duration): Also parse `[No Duration]` as duration --- src/select/selection_file/duration.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/select/selection_file') diff --git a/src/select/selection_file/duration.rs b/src/select/selection_file/duration.rs index 4224ead..f7a39cb 100644 --- a/src/select/selection_file/duration.rs +++ b/src/select/selection_file/duration.rs @@ -28,6 +28,10 @@ impl FromStr for Duration { .context("Failed to parse hours") } + if s == "[No Duration]" { + return Ok(Self { time: 0 }); + } + let buf: Vec<_> = s.split(' ').collect(); let hours; @@ -45,7 +49,10 @@ impl FromStr for Duration { minutes = parse_num(buf[0], 'm')?; seconds = parse_num(buf[1], 's')?; } else { - unreachable!("The first part always ends with 'h' or 'm'") + unreachable!( + "The first part always ends with 'h' or 'm', but was: {:#?}", + buf + ) } Ok(Self { -- cgit 1.4.1