ACTIVEMQ6-55: prevent NPE when closing a link that didnt get as far as having a context added

This commit is contained in:
Robert Gemmell 2015-03-12 11:42:29 +00:00 committed by Clebert Suconic
parent d47fba4251
commit 983effca9d
1 changed files with 5 additions and 1 deletions

View File

@ -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();
}
}