From dac3322b97f98e3475118bf893740f0a51496ebb Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 5 Aug 2022 14:04:23 -0400 Subject: [PATCH] fix: skip route accounting on no match --- runtime/include/http_session.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/include/http_session.h b/runtime/include/http_session.h index 8dc91b4..21840df 100644 --- a/runtime/include/http_session.h +++ b/runtime/include/http_session.h @@ -179,7 +179,9 @@ http_session_set_response_header(struct http_session *session, int status_code, assert(session != NULL); assert(status_code >= 200 && status_code <= 599); http_total_increment(status_code); - route_metrics_increment(&session->route->metrics, status_code); + + /* We might not have actually matched a route */ + if (likely(session->route != NULL)) { route_metrics_increment(&session->route->metrics, status_code); } if (status_code == 200) { session->response_header_length = snprintf(session->response_header,