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:
parent
7e0ac91231
commit
8e9b51a412
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user