Skip to content

Commit

Permalink
Backport of fix(#13844): canonicalize job to avoid nil pointer defere…
Browse files Browse the repository at this point in the history
…nce into release/1.3.x (#16016)

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core committed Feb 1, 2023
1 parent 97f60a3 commit 7997107
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 @@ -800,7 +800,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 7997107

Please sign in to comment.