mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
format: Don't assert on errors in getters
This makes handling errors in getter functions more graceful, rather than triggering warnings/asserts. Better to be less trigger-happy about these things since this is now public-facing API.
This commit is contained in:
parent
6f20d39a1c
commit
63429b67c7
1 changed files with 10 additions and 3 deletions
|
|
@ -308,9 +308,14 @@ int pa_format_info_get_prop_int(pa_format_info *f, const char *key, int *v) {
|
|||
pa_assert(key);
|
||||
pa_assert(v);
|
||||
|
||||
pa_return_val_if_fail(str = pa_proplist_gets(f->plist, key), -PA_ERR_NOENTITY);
|
||||
str = pa_proplist_gets(f->plist, key);
|
||||
if (!str)
|
||||
return -PA_ERR_NOENTITY;
|
||||
|
||||
o = json_tokener_parse(str);
|
||||
pa_return_val_if_fail(!is_error(o), -PA_ERR_INVALID);
|
||||
if (is_error(o))
|
||||
return -PA_ERR_INVALID;
|
||||
|
||||
if (json_object_get_type(o) != json_type_int) {
|
||||
json_object_put(o);
|
||||
return -PA_ERR_INVALID;
|
||||
|
|
@ -335,7 +340,9 @@ int pa_format_info_get_prop_string(pa_format_info *f, const char *key, char **v)
|
|||
return -PA_ERR_NOENTITY;
|
||||
|
||||
o = json_tokener_parse(str);
|
||||
pa_return_val_if_fail(!is_error(o), -PA_ERR_INVALID);
|
||||
if (is_error(o))
|
||||
return -PA_ERR_INVALID;
|
||||
|
||||
if (json_object_get_type(o) != json_type_string) {
|
||||
json_object_put(o);
|
||||
return -PA_ERR_INVALID;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue