QPID-7531: [Java Broker] [AMQP 1.0] Prevent possibility of NPE during peer initiated connection close
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
index 3d9beef..a55264e 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
@@ -336,6 +336,7 @@
         closeSaslWithFailure();
     }
 
+    @Override
     public void receiveClose(final short channel, final Close close)
     {
         assertState(FrameReceivingState.ANY_FRAME);
@@ -353,10 +354,11 @@
                 _connectionState = ConnectionState.CLOSE_RECEIVED;
                 if(close.getError() != null)
                 {
-                    ErrorCondition condition = _remoteError.getCondition();
+                    final Error error = close.getError();
+                    ErrorCondition condition = error.getCondition();
                     Symbol errorCondition = condition == null ? null : condition.getValue();
                     LOGGER.info("{} : Connection closed with error : {} - {}", getLogSubject(),
-                                errorCondition, _remoteError.getDescription());
+                                errorCondition, close.getError().getDescription());
                 }
                 sendClose(new Close());
                 _connectionState = ConnectionState.CLOSED;