Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reject non-null tokens beginning with n
In 0f609dd, a regression was introduced where the parser would read any token that started with n as null. The `.type()` method returns `json_type::null` simply if the token begins with `n`, and it does not check whether the token is actually valid. Adding an `is_null()` call here ensures this and returns an error if the token starts with `n` but is not `null`. Calling `.value()` on the returned value will raise it as an exception if `is_null()` returned an error. Currently with simdjson 3.10.1, there is a bug where calling `is_null` on a document object lacks this behaviour, so currently this patch only fixes the problem for non-scalar documents.
- Loading branch information