fix: check for nil client before closing in amqp (#10635)
This commit is contained in:
parent
6ae9320275
commit
0c4df85c2d
|
|
@ -259,7 +259,7 @@ func (q *AMQP) Write(metrics []telegraf.Metric) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else if q.client != nil {
|
||||||
if err := q.client.Close(); err != nil {
|
if err := q.client.Close(); err != nil {
|
||||||
q.Log.Errorf("Closing connection failed: %v", err)
|
q.Log.Errorf("Closing connection failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue