From 7c81f5936fc4447ae2de2b80619c66f8e4086931 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Tue, 15 Feb 2022 09:21:20 -0800 Subject: [PATCH] fix: check for nil client before closing in amqp (#10635) (cherry picked from commit 0c4df85c2de2228dfb64b72d9854da714de3a8b3) --- plugins/outputs/amqp/amqp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/outputs/amqp/amqp.go b/plugins/outputs/amqp/amqp.go index b7029ea77a5f2..68aeeeca3a5cb 100644 --- a/plugins/outputs/amqp/amqp.go +++ b/plugins/outputs/amqp/amqp.go @@ -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) }