Skip to content

Commit 8e2816d

Browse files
committed
fix: use checked_mul() to avoid overflow panic
1 parent 7d0c3e4 commit 8e2816d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/items/relative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn displacement(input: &mut &str) -> ModalResult<Relative> {
110110
Some(match unit.strip_suffix('s').unwrap_or(unit) {
111111
"year" => Relative::Years(multipler),
112112
"month" => Relative::Months(multipler),
113-
"fortnight" => Relative::Days(14 * multipler),
113+
"fortnight" => Relative::Days(multipler.checked_mul(14)?),
114114
"week" => Relative::Days(7 * multipler),
115115
"day" => Relative::Days(multipler),
116116
"hour" => Relative::Hours(multipler),

0 commit comments

Comments
 (0)