Skip to content

Commit

Permalink
Fix HTTP2 NPE issue
Browse files Browse the repository at this point in the history
Fixes: #25658

Co-authored-by: Guillaume Smet <[email protected]>
  • Loading branch information
geoand and gsmet committed May 19, 2022
1 parent aa8ba94 commit 7c8c580
Showing 1 changed file with 8 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,13 @@ 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 {
// we don't know if other instances handle a null handler so just use the future form
response.end();
}
}
return this;
}
Expand Down

0 comments on commit 7c8c580

Please sign in to comment.