Skip to content

Commit

Permalink
Fix HTTP2 NPE issue
Browse files Browse the repository at this point in the history
Fixes: #25658
  • Loading branch information
geoand committed May 19, 2022
1 parent aa8ba94 commit 75fecfa
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.http.impl.Http1xServerResponse;
import io.vertx.core.net.impl.ConnectionBase;
import io.vertx.ext.web.RoutingContext;
import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -328,7 +329,12 @@ public ServerHttpResponse setStatusCode(int code) {
@Override
public ServerHttpResponse end() {
if (!response.ended()) {
response.end((Handler<AsyncResult<Void>>) null);
if (response instanceof Http1xServerResponse) {
// Http1xServerResponse correctly handles a null handler
response.end((Handler<AsyncResult<Void>>) null);
} else {
response.end();
}
}
return this;
}
Expand Down

0 comments on commit 75fecfa

Please sign in to comment.