diff --git a/lib/ns/query.c b/lib/ns/query.c index 48182fe80a..baa867e2f8 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -9600,7 +9600,9 @@ query_nxdomain(query_ctx_t *qctx, isc_result_t res) { { ttl = 0; } - if (!qctx->nxrewrite || qctx->rpz_st->m.rpz->addsoa) { + if (!qctx->nxrewrite || + (qctx->rpz_st != NULL && qctx->rpz_st->m.rpz->addsoa)) + { result = query_addsoa(qctx, ttl, section); if (result != ISC_R_SUCCESS) { QUERY_ERROR(qctx, result);