fix: check for nil client before closing in amqp (#10635)

This commit is contained in:
Joshua Powers 2022-02-15 09:21:20 -08:00 committed by GitHub
parent 6ae9320275
commit 0c4df85c2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -259,7 +259,7 @@ func (q *AMQP) Write(metrics []telegraf.Metric) error {
if err != nil {
return err
}
} else {
} else if q.client != nil {
if err := q.client.Close(); err != nil {
q.Log.Errorf("Closing connection failed: %v", err)
}