json: check spa_json_get_string() return value correctly

It is only successful when > 0.
This commit is contained in:
Wim Taymans 2022-01-04 10:15:35 +01:00
parent 13c0cbb899
commit 68b31d37d9
2 changed files with 2 additions and 2 deletions

View file

@ -183,7 +183,7 @@ static void load_quirks(struct spa_bt_quirks *this, const char *str, size_t len)
if (spa_json_enter_object(&data, &rules) <= 0) if (spa_json_enter_object(&data, &rules) <= 0)
spa_json_init(&rules, str, len); spa_json_init(&rules, str, len);
while (spa_json_get_string(&rules, key, sizeof(key)-1)) { while (spa_json_get_string(&rules, key, sizeof(key)-1) > 0) {
int sz; int sz;
const char *value; const char *value;

View file

@ -166,7 +166,7 @@ int pw_properties_update_string(struct pw_properties *props, const char *str, si
if (spa_json_enter_object(&it[0], &it[1]) <= 0) if (spa_json_enter_object(&it[0], &it[1]) <= 0)
spa_json_init(&it[1], str, size); spa_json_init(&it[1], str, size);
while (spa_json_get_string(&it[1], key, sizeof(key)-1)) { while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
int len; int len;
const char *value; const char *value;