tisonkun / cronexpr

Calculate the next timestamp matching a given crontab pattern
https://docs.rs/cronexpr
Apache License 2.0
47 stars 2 forks source link

fix: panic on out-of-bounds indexing #9

Closed haoqixu closed 1 week ago

haoqixu commented 1 week ago

Avoid panic on out-of-bounds indexing when parsing incomplete expressions.

tisonkun commented 1 week ago

You can add a test case like assert_snapshot!(parse_crontab("0").unwrap_err()); to parse_crontab_failed.

tisonkun commented 1 week ago

or throw error on find(' ') return None instead of unwrap_or.