Skip to content

Commit

Permalink
fix: nullptr caused by failed HttpHandler::SwitchHTTP2()(#560). (#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperBigYB authored May 31, 2024
1 parent 336e748 commit a56fc78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions http/server/HttpHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ void HttpHandler::Close() {
}

bool HttpHandler::SwitchHTTP2() {
parser.reset(HttpParser::New(HTTP_SERVER, ::HTTP_V2));
if (parser == NULL) {
HttpParser* http2_parser = HttpParser::New(HTTP_SERVER, ::HTTP_V2);
if (http2_parser == NULL) {
return false;
}
parser.reset(http2_parser);
protocol = HTTP_V2;
resp->http_major = req->http_major = 2;
resp->http_minor = req->http_minor = 0;
Expand Down

0 comments on commit a56fc78

Please sign in to comment.