修复HttpRequest.getRemoteAddress()方法中channel已关闭会抛空指针异常的BUG

This commit is contained in:
Redkale
2017-02-22 16:06:40 +08:00
parent 7ca95c3549
commit a778af73d8

View File

@@ -236,7 +236,7 @@ public class HttpRequest extends Request<HttpContext> {
* @return 地址
*/
public SocketAddress getRemoteAddress() {
return this.channel.getRemoteAddress();
return this.channel == null || !this.channel.isOpen() ? null : this.channel.getRemoteAddress();
}
/**