Fixed issue: NETTY-9 (DefaultChannelPipline.getFirst() and getLast() throws NullPointerException if the pipeline is empty.)

* Added null check code in getFirst() and getLast()
This commit is contained in:
Trustin Lee 2008-08-18 02:27:11 +00:00
parent 7e0ac91231
commit 8e9b51a412

View File

@ -229,10 +229,18 @@ public class DefaultChannelPipeline implements ChannelPipeline {
}
public synchronized ChannelHandler getFirst() {
DefaultChannelHandlerContext head = this.head;
if (head == null) {
return null;
}
return head.getHandler();
}
public synchronized ChannelHandler getLast() {
DefaultChannelHandlerContext tail = this.tail;
if (tail == null) {
return null;
}
return tail.getHandler();
}