Skip to content

json-parser: Fix getting immutable root nodes from empty input

If parsing an empty document, it’s allowed to return NULL from json_parser_get_root(). This was broken for immutable parsers when immutability support was added (an assertion fails). Fix that, and also document that json_parser_get_root() may return NULL.

Do the same for json_parser_steal_root() too, which is another way that the root node may be NULL.

Add a unit test.

Signed-off-by: Philip Withnall withnall@endlessm.com

Merge request reports