sd-json: fix conditions

Fixes a bug in 6647bbeab1 (v257).

Fixes CID#1609496.
This commit is contained in:
Yu Watanabe
2025-04-24 14:52:08 +09:00
parent dcedcb443c
commit 90e799de1f

View File

@@ -4911,10 +4911,10 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
if (r < 0)
goto finish;
r = command == _SD_JSON_BUILD_BASE64 ? sd_json_variant_new_base64(&add_more, p, sz) :
command == _SD_JSON_BUILD_BASE32HEX ? sd_json_variant_new_base32hex(&add_more, p, sz) :
command == _SD_JSON_BUILD_HEX ? sd_json_variant_new_hex(&add_more, p, sz) :
sd_json_variant_new_octescape(&add_more, p, sz);
r = command == _JSON_BUILD_PAIR_BASE64_NON_EMPTY ? sd_json_variant_new_base64(&add_more, p, sz) :
command == _JSON_BUILD_PAIR_BASE32HEX_NON_EMPTY ? sd_json_variant_new_base32hex(&add_more, p, sz) :
command == _JSON_BUILD_PAIR_HEX_NON_EMPTY ? sd_json_variant_new_hex(&add_more, p, sz) :
sd_json_variant_new_octescape(&add_more, p, sz);
if (r < 0)
goto finish;
}