mirror of
https://github.com/nlohmann/json.git
synced 2026-05-08 23:35:24 +00:00
Remove nullptr safety check from sax_parse functions (#5139)
PR #4873 introduced a safety check in sax_parse functions to catch nullptr passed as SAX parser object, which had been already annotated by JSON_HEDLEY_NON_NULL macro. Compilers (e.g. clang) which respected the non-null annotation tended to eliminate the safety check completely in optimized builds, while compilers which did not, compiled the safety check in. This led to different behaviors accross different compilers/platforms and/or build types (debug, release). This commit reverts PR #4873 to remove this discrepancy. Passing null to non-null annotated parameter is considered to be undefined behavior. Fixes #5048 Signed-off-by: Richard Musil <risa2000x@gmail.com> Co-authored-by: Richard Musil <risa2000x@gmail.com>
This commit is contained in:
@@ -900,13 +900,3 @@ A JSON Patch operation 'test' failed. The unsuccessful operation is also printed
|
||||
```
|
||||
[json.exception.other_error.501] unsuccessful: {"op":"test","path":"/baz","value":"bar"}
|
||||
```
|
||||
|
||||
### json.exception.other_error.502
|
||||
|
||||
This exception is thrown when a null pointer is passed as SAX event listener to the [sax_parse](../api/basic_json/sax_parse.md) function.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
```
|
||||
[json.exception.other_error.502] SAX handler must not be null
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user