Skip to content

Commit

Permalink
Merge pull request #74 from snaka/fix/panic-when-omit-conf-option
Browse files Browse the repository at this point in the history
fix: `-conf` omitted caused panic by referencing a nil pointer
  • Loading branch information
Songmu authored Aug 25, 2023
2 parents 03cd9a9 + 28abb53 commit b6e383d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var cmdApply = &runnerImpl{
return err
}
}
if c == nil {
return errors.New("-conf option required")
}

var ruleNames []string
if !*all {
Expand Down
3 changes: 3 additions & 0 deletions cmd_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var cmdDiff = &runnerImpl{
return err
}
}
if c == nil {
return errors.New("-conf option required")
}

var ruleNames []string
if !*all {
Expand Down
3 changes: 3 additions & 0 deletions cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ var cmdRun = &runnerImpl{
return err
}
}
if c == nil {
return errors.New("-conf option required")
}
ru := c.GetRuleByName(*rule)
if ru == nil {
return fmt.Errorf("no rules found for %s", *rule)
Expand Down

0 comments on commit b6e383d

Please sign in to comment.