修复HttpRequest.getRemoteAddress()方法中channel已关闭会抛空指针异常的BUG
This commit is contained in:
@@ -236,7 +236,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* @return 地址
|
* @return 地址
|
||||||
*/
|
*/
|
||||||
public SocketAddress getRemoteAddress() {
|
public SocketAddress getRemoteAddress() {
|
||||||
return this.channel.getRemoteAddress();
|
return this.channel == null || !this.channel.isOpen() ? null : this.channel.getRemoteAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user