[common,settings] fix add_string_or_null

* If the value is NULL do not check WINPR_JSON_AddNullToObject return as
  that is most likely also NULL
* Fix testcase, always use goto for error handling
This commit is contained in:
Armin Novak
2025-04-23 09:30:49 +02:00
parent 3532cc0dc9
commit 6a20b7bfd8
2 changed files with 4 additions and 3 deletions

View File

@@ -2616,7 +2616,8 @@ static BOOL add_string_or_null(WINPR_JSON* json, const char* key, const char* va
if (value)
return WINPR_JSON_AddStringToObject(json, key, value) != NULL;
return WINPR_JSON_AddNullToObject(json, key) != NULL;
(void)WINPR_JSON_AddNullToObject(json, key);
return TRUE;
}
static WINPR_JSON* json_from_device_item(const RDPDR_DEVICE* val)