summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordfhoughton <dfhoughton@gmail.com>2020-01-04 16:32:48 -0500
committerdfhoughton <dfhoughton@gmail.com>2020-01-04 16:32:48 -0500
commitb41efb6ccc6174b6c0d2cd05f2b42c1ce8b653e8 (patch)
tree603deca9cfe58393c41fc5693f24bc1381bab8c7 /src
parent15fe9df0aac52e46ee07d9f0bf5f2342b0dc1924 (diff)
downloadtwo-timer-b41efb6ccc6174b6c0d2cd05f2b42c1ce8b653e8.zip
fixed panic
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c544620..bc54e38 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1470,7 +1470,12 @@ fn time(m: &Match) -> (u32, Option<u32>, Option<u32>, bool) {
};
}
let hour = if let Some(hour_24) = m.name("hour_24") {
- s_to_n(hour_24.name("h24").unwrap().as_str())
+ let hour = s_to_n(hour_24.name("h24").unwrap().as_str());
+ if hour == 24 {
+ 0
+ } else {
+ hour
+ }
} else if let Some(hour_12) = m.name("hour_12") {
let mut hour = s_to_n(hour_12.name("h12").unwrap().as_str());
hour = if let Some(am_pm) = m.name("am_pm") {