Avoiding NPEs when using ClientConnector directly.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-07-31 15:30:18 +02:00
parent ffd8e303f1
commit 6753b43d41
1 changed files with 4 additions and 2 deletions

View File

@ -274,7 +274,8 @@ public class ClientConnector extends ContainerLifeCycle
LOG.debug("Could not accept {}", channel);
safeClose(channel);
Promise<?> promise = (Promise<?>)context.get(CONNECTION_PROMISE_CONTEXT_KEY);
promise.failed(failure);
if (promise != null)
promise.failed(failure);
}
}
@ -301,7 +302,8 @@ public class ClientConnector extends ContainerLifeCycle
if (LOG.isDebugEnabled())
LOG.debug("Could not connect to {}", context.get(REMOTE_SOCKET_ADDRESS_CONTEXT_KEY));
Promise<?> promise = (Promise<?>)context.get(CONNECTION_PROMISE_CONTEXT_KEY);
promise.failed(failure);
if (promise != null)
promise.failed(failure);
}
protected class ClientSelectorManager extends SelectorManager