.type = JSON_TYPE_STRING,
};
- arg.string = (char *)val;
+ arg.string = strdup(val ? : "");
return json_object_add_value_type(obj, name, &arg);
}
{
struct json_value arg = {
.type = JSON_TYPE_OBJECT,
- .object = val,
};
+ arg.object = val;
return json_object_add_value_type(obj, name, &arg);
}