https://issues.apache.org/jira/browse/AMQ-5431 - prevent NPE when a Detach frame is received for a

link that didn't get as far as setting a context during creation before being
 detached/closed
This commit is contained in:
Dejan Bosanac 2014-11-25 10:42:55 +01:00
parent 08b1bedc6d
commit 5cd56e7fb1
1 changed files with 4 additions and 1 deletions

View File

@ -351,7 +351,10 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
if (remoteState == EndpointState.ACTIVE) {
onLinkOpen(link);
} else if (remoteState == EndpointState.CLOSED) {
((AmqpDeliveryListener) link.getContext()).onClose();
AmqpDeliveryListener context = (AmqpDeliveryListener) link.getContext();
if (context != null) {
context.onClose();
}
link.close();
link.free();
}