sd-json: make sure SD_JSON_BUILD_STRING_UNDERSCORIFY() can deal with NULL strings

SD_JSON_BUILD_STRING() and everything else can deal with it, make sure
SD_JSON_BUILD_STRING_UNDERSCORIFY() can too.
This commit is contained in:
Lennart Poettering
2026-04-20 09:36:06 +02:00
parent 6548da06fc
commit a77a95665f
+1 -1
View File
@@ -3595,7 +3595,7 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
if (current->n_suppress == 0) {
_cleanup_free_ char *c = NULL;
if (command == _JSON_BUILD_STRING_UNDERSCORIFY) {
if (command == _JSON_BUILD_STRING_UNDERSCORIFY && p) {
c = strdup(p);
if (!c) {
r = -ENOMEM;