diff --git a/lib/src/HttpServer.cc b/lib/src/HttpServer.cc index 38108366..9d469d35 100755 --- a/lib/src/HttpServer.cc +++ b/lib/src/HttpServer.cc @@ -251,7 +251,7 @@ void HttpServer::onRequest(const TcpConnectionPtr &conn, const HttpRequestImplPt { conn->getLoop()->queueInLoop([conn, req, newResp, this]() { HttpServerContext *context = any_cast(conn->getMutableContext()); - if (context->getFirstRequest() == req) + if (context && context->getFirstRequest() == req) { context->popFirstRequest(); sendResponse(conn, newResp);