diff --git a/src/api/HttpHookState.cc b/src/api/HttpHookState.cc index 1221bfa0b40..d6c988fc73c 100644 --- a/src/api/HttpHookState.cc +++ b/src/api/HttpHookState.cc @@ -75,10 +75,12 @@ HttpHookState::getNext() void HttpHookState::Scope::init(HttpAPIHooks const *feature_hooks, TSHttpHookID id) { + // operator[] yields nullptr for an out of range id, and a release build can reach that: the only thing rejecting a + // bad hook id upstream is an assert that compiles out. Leave the scope empty rather than dereferencing null. _hooks = (*feature_hooks)[id]; _p = nullptr; - _c = _hooks->head(); + _c = _hooks ? _hooks->head() : nullptr; } APIHook const *