From: Lennart Poettering Date: Fri, 29 Aug 2025 13:17:56 +0000 (+0200) Subject: sd-json: allow sd_json_dispatch() accept NULL pointers and treat them like empty... X-Git-Tag: v259-rc1~521^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F38980%2Fhead;p=thirdparty%2Fsystemd.git sd-json: allow sd_json_dispatch() accept NULL pointers and treat them like empty objects --- diff --git a/src/libsystemd/sd-json/sd-json.c b/src/libsystemd/sd-json/sd-json.c index 182a85ae7ff..77f7524d2a1 100644 --- a/src/libsystemd/sd-json/sd-json.c +++ b/src/libsystemd/sd-json/sd-json.c @@ -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.");