[#1770] Fix NPE which was thrown if connection timeout was disabled and the connect did not finish directly when using NIO

This commit is contained in:
Norman Maurer 2013-08-22 12:38:56 +02:00
parent 6a2f340ec0
commit 9fd35d09a2

View File

@ -240,7 +240,11 @@ public abstract class AbstractNioChannel extends AbstractChannel {
connectPromise.setFailure(t);
closeIfClosed();
} finally {
connectTimeoutFuture.cancel(false);
// Check for null as the connectTimeoutFuture is only created if a connectTimeoutMillis > 0 is used
// See https://github.com/netty/netty/issues/1770
if (connectTimeoutFuture != null) {
connectTimeoutFuture.cancel(false);
}
connectPromise = null;
}
}