Skip to content

Commit

Permalink
Merge pull request #45 from sg3-141-592/negative-step-check
Browse files Browse the repository at this point in the history
Fix for negative step in cron expression
  • Loading branch information
adhocore authored Sep 23, 2024
2 parents 28b4284 + 54c6452 commit 7357f70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions gronx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func TestIsValid(t *testing.T) {
if gron.IsValid("* * * *") {
t.Errorf("expected false, got true")
}
if gron.IsValid("0-0/-005 * * * *") {
t.Errorf("expected true, got false")
}
})

}
Expand Down
2 changes: 1 addition & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func inStep(val int, s string, bounds []int) (bool, error) {
if err != nil {
return false, err
}
if step == 0 {
if step <= 0 {
return false, errors.New("step can't be 0")
}

Expand Down

0 comments on commit 7357f70

Please sign in to comment.