Skip to content

Commit

Permalink
fix(#13844): canonicalize job to avoid nil pointer deference (#13845)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanpemble committed Feb 1, 2023
1 parent fcc6cfa commit 67f8f22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/13845.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
api: Fixed a nil pointer dereference when periodic jobs are missing their periodic spec
```
2 changes: 1 addition & 1 deletion api/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ func (p *PeriodicConfig) Canonicalize() {
// returned. The `time.Location` of the returned value matches that of the
// passed time.
func (p *PeriodicConfig) Next(fromTime time.Time) (time.Time, error) {
if *p.SpecType == PeriodicSpecCron {
if p != nil && *p.SpecType == PeriodicSpecCron {
e, err := cronexpr.Parse(*p.Spec)
if err != nil {
return time.Time{}, fmt.Errorf("failed parsing cron expression %q: %v", *p.Spec, err)
Expand Down

0 comments on commit 67f8f22

Please sign in to comment.