We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9585fd5 commit 092df97Copy full SHA for 092df97
parser.go
@@ -76,6 +76,9 @@ func NewParser(options ParseOption) Parser {
76
// It returns a descriptive error if the spec is not valid.
77
// It accepts crontab specs and features configured by NewParser.
78
func (p Parser) Parse(spec string) (Schedule, error) {
79
+ if len(spec) == 0 {
80
+ return nil, fmt.Errorf("Empty spec string")
81
+ }
82
if spec[0] == '@' && p.options&Descriptor > 0 {
83
return parseDescriptor(spec)
84
}
parser_test.go
@@ -175,6 +175,10 @@ func TestParse(t *testing.T) {
175
expr: "* * * *",
176
err: "Expected 5 to 6 fields",
177
},
178
+ {
179
+ expr: "",
180
+ err: "Empty spec string",
181
+ },
182
183
184
for _, c := range entries {
0 commit comments