Skip to content

Commit

Permalink
Fix JMX nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarocabanas committed Feb 13, 2024
1 parent 694b359 commit 17e0d1b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jmx/jmx.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
Package jmx is a library to get metrics through JMX. It requires additional
setup. Read https://github.com/newrelic/infra-integrations-sdk#jmx-support for
instructions. */
instructions.
*/
package jmx

import (
Expand Down Expand Up @@ -242,8 +243,10 @@ func openConnection(config *connectionConfig) (err error) {
}

go func() {
if err = cmd.Wait(); err != nil {
cmdErrC <- jmxClientError(fmt.Sprintf("nrjmx error: %s [proc-state: %s]", err, cmd.ProcessState))
if cmd != nil {
if err = cmd.Wait(); err != nil {
cmdErrC <- jmxClientError(fmt.Sprintf("nrjmx error: %s [proc-state: %s]", err, cmd.ProcessState))
}
}

cmd = nil
Expand Down

0 comments on commit 17e0d1b

Please sign in to comment.