diff --git a/activemq-protocols/activemq-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java b/activemq-protocols/activemq-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java index 35d52bff52..20b2d8b162 100644 --- a/activemq-protocols/activemq-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java +++ b/activemq-protocols/activemq-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java @@ -255,7 +255,11 @@ public abstract class AbstractConnectionContext extends ProtonInitializable impl public void onRemoteClose(Link link) throws Exception { link.close(); - ((ProtonDeliveryHandler) link.getContext()).close(); + ProtonDeliveryHandler linkContext = (ProtonDeliveryHandler) link.getContext(); + if (linkContext != null) + { + linkContext.close(); + } }