diff --git a/.changelog/13845.txt b/.changelog/13845.txt new file mode 100644 index 000000000..88778bcc8 --- /dev/null +++ b/.changelog/13845.txt @@ -0,0 +1,3 @@ +```release-note:bug +api: Fixed a nil pointer dereference when periodic jobs are missing their periodic spec +``` diff --git a/api/jobs.go b/api/jobs.go index a90111897..c9921c9fd 100644 --- a/api/jobs.go +++ b/api/jobs.go @@ -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)