From 89555c2151c2e1a348d967976722f6cf667dfe9b Mon Sep 17 00:00:00 2001
From: Dragos Oancea <dragos@signalwire.com>
Date: Tue, 25 Feb 2020 22:09:33 +0000
Subject: [PATCH] [mod_amqp] scan-build: Dereference of null pointer (loaded
 from variable 'active') - mod_amqp_connection_open()

---
 src/mod/event_handlers/mod_amqp/mod_amqp_connection.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c
index 7f56c9579c..2210ed032a 100644
--- a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c
+++ b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c
@@ -126,7 +126,9 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
 		}
 	}
 
-	*active = connection_attempt;
+	if (active) {
+		*active = connection_attempt;
+	}
 
 	if (!connection_attempt) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile[%s] could not connect to any AMQP brokers\n", profile_name);