From 3dd1b600b8b76f480d27872f49a52b83a4960004 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 May 2019 10:44:56 +0200 Subject: [PATCH] json: permit 'null' as a way to reset tri-states to default --- src/shared/json.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/json.c b/src/shared/json.c index 5d3c6aad91..38b2bb14e4 100644 --- a/src/shared/json.c +++ b/src/shared/json.c @@ -3826,6 +3826,11 @@ int json_dispatch_tristate(const char *name, JsonVariant *variant, JsonDispatchF assert(variant); assert(b); + if (json_variant_is_null(variant)) { + *b = -1; + return 0; + } + if (!json_variant_is_boolean(variant)) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a boolean.", strna(name));