sd-json: allow sd_json_dispatch() accept NULL pointers and treat them like empty objects

This commit is contained in:
Lennart Poettering
2025-09-18 09:15:05 +02:00
parent 6be5b61238
commit 8c7c808f84
+4
View File
@@ -5096,6 +5096,10 @@ _public_ int sd_json_dispatch_full(
int r, done = 0;
bool *found;
/* Consider a NULL pointer equivalent to an empty object */
if (!v)
v = JSON_VARIANT_MAGIC_EMPTY_OBJECT;
if (!sd_json_variant_is_object(v)) {
json_log(v, flags, 0, "JSON variant is not an object.");