Problem
Using .unwrap() will panic if the duration is too large to convert (> ~584 years).
Locations: src/core/schedule.rs:204 and src/core/schedule.rs:237
let next = after + chrono::Duration::from_std(*duration).unwrap();
Recommendation
Return an error instead:
let chrono_duration = chrono::Duration::from_std(*duration)
.map_err(|_| ScheduleError::InvalidInterval("duration too large".into()))?;
let next = after + chrono_duration;
Apply this fix in both next_after() (line 204) and next_n_after() (line 237).
Priority
Critical - Panics should be avoided in library code.
Created from PR review: #28 (comment)
Problem
Using
.unwrap()will panic if the duration is too large to convert (> ~584 years).Locations:
src/core/schedule.rs:204andsrc/core/schedule.rs:237Recommendation
Return an error instead:
Apply this fix in both
next_after()(line 204) andnext_n_after()(line 237).Priority
Critical - Panics should be avoided in library code.
Created from PR review: #28 (comment)