From 01139dc19292887aaf2c2ceb439448023d124c97 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 24 Oct 2026 17:10:31 +0200 Subject: [PATCH] Silence an Infer false positive in json_view materialize (#5905) Signed-off-by: Niels Lohmann --- include/nlohmann/detail/view/materialize.hpp | 2 ++ single_include/nlohmann/json_view.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nlohmann/detail/view/materialize.hpp b/include/nlohmann/detail/view/materialize.hpp index 006bdd0f3..62adb30a9 100644 --- a/include/nlohmann/detail/view/materialize.hpp +++ b/include/nlohmann/detail/view/materialize.hpp @@ -143,6 +143,8 @@ BasicJsonType materialize(const document_data& d, const node* n) case value_t::binary: case value_t::discarded: default: + // false positive: the parser's frame stack points into its own storage (never null) + // @infer-ignore NULLPTR_DEREFERENCE sax.null(); break; } diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index 1e2f8f64c..6de8ee77d 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -6152,6 +6152,8 @@ BasicJsonType materialize(const document_data& d, const node* n) case value_t::binary: case value_t::discarded: default: + // false positive: the parser's frame stack points into its own storage (never null) + // @infer-ignore NULLPTR_DEREFERENCE sax.null(); break; }