json-pod: return errors from spa_json_next()

Instead of silently ignoring the error and continuing.

See #4313
This commit is contained in:
Wim Taymans 2024-09-23 09:35:00 +02:00
parent ba44236f8f
commit bf4bb9fcc1

View file

@ -54,6 +54,8 @@ static inline int spa_json_to_pod_part(struct spa_pod_builder *b, uint32_t flags
if ((res = spa_json_to_pod_part(b, flags, id, pi, &it[0], v, l)) < 0) if ((res = spa_json_to_pod_part(b, flags, id, pi, &it[0], v, l)) < 0)
return res; return res;
} }
if (l < 0)
return l;
spa_pod_builder_pop(b, &f[0]); spa_pod_builder_pop(b, &f[0]);
} }
else if (spa_json_is_array(value, len)) { else if (spa_json_is_array(value, len)) {
@ -67,6 +69,8 @@ static inline int spa_json_to_pod_part(struct spa_pod_builder *b, uint32_t flags
while ((l = spa_json_next(&it[0], &v)) > 0) while ((l = spa_json_next(&it[0], &v)) > 0)
if ((res = spa_json_to_pod_part(b, flags, id, info, &it[0], v, l)) < 0) if ((res = spa_json_to_pod_part(b, flags, id, info, &it[0], v, l)) < 0)
return res; return res;
if (l < 0)
return l;
spa_pod_builder_pop(b, &f[0]); spa_pod_builder_pop(b, &f[0]);
} }
else if (spa_json_is_float(value, len)) { else if (spa_json_is_float(value, len)) {