Mark Infer's null dereference in materialize() as a false positive

Infer (ci_infer, also red on develop since #5882) reports a null
dereference in json_sax_dom_parser::null() called from materialize(). The
member pointer the parser stores a value of an object in is set by the
key() before it, so it is not null there.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-24 15:40:31 +02:00
1 parent 6775994761
commit 182b31f902
2 files changed
+6

No files matched your search

@@ -143,6 +143,9 @@ BasicJsonType materialize(const document_data& d, const node* n)
case value_t::binary:
case value_t::discarded:
default:
// false positive: a value in an object follows its key(), which set the
// member the parser stores it in
// @infer-ignore NULLPTR_DEREFERENCE
sax.null();
break;
}
+3
View File
@@ -7185,6 +7185,9 @@ BasicJsonType materialize(const document_data& d, const node* n)
case value_t::binary:
case value_t::discarded:
default:
// false positive: a value in an object follows its key(), which set the
// member the parser stores it in
// @infer-ignore NULLPTR_DEREFERENCE
sax.null();
break;
}