connection_attempt->password);
if (mod_amqp_log_if_amqp_error(status, "Logging in")) {
- mod_amqp_connection_close(*active);
- *active = NULL;
+ if (active) {
+ mod_amqp_connection_close(*active);
+ *active = NULL;
+ }
goto err;
}
// Open a channel (1). This is fairly standard
amqp_channel_open(newConnection, 1);
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(newConnection), "Opening channel")) {
- mod_amqp_connection_close(*active);
- *active = NULL;
+ if (active) {
+ mod_amqp_connection_close(*active);
+ *active = NULL;
+ }
goto err;
}
- (*active)->state = newConnection;
+ if (active) {
+ (*active)->state = newConnection;
+ }
if (oldConnection) {
amqp_destroy_connection(oldConnection);