Skip to content

Commit

Permalink
Use length check for perfdata instead of nil check
Browse files Browse the repository at this point in the history
This change accounts for the potential to receive an empty
slice in addition to a nil slice (as we were checking for
prior to this change).

refs GH-104
  • Loading branch information
atc0005 committed Nov 29, 2021
1 parent b399b44 commit beae761
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nagios.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (es *ExitState) ReturnCheckResults() {
// directly.
func (es *ExitState) AddPerfData(skipValidate bool, pd ...PerformanceData) error {

if pd == nil {
if len(pd) == 0 {
return fmt.Errorf("no performance data provided")
}

Expand Down

0 comments on commit beae761

Please sign in to comment.