Skip to content

Commit

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

bool HttpHandler::SwitchHTTP2() {
parser.reset(HttpParser::New(HTTP_SERVER, ::HTTP_V2));
if (parser == NULL) {
HttpParser *new_parser = HttpParser::New(HTTP_SERVER, ::HTTP_V2);
if (new_parser != NULL) {
parser.reset(new_parser);
} else {
return false;
}
protocol = HTTP_V2;
Expand Down

0 comments on commit 9b5ccb5

Please sign in to comment.