[PATCH] sink-input: Don't assert when removing non-existent volume factor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This makes it easier for users of this API to add/updated a volume
factor by doing a _remove_volume_factor() followed by an
add_volume_factor(), rather than having to either remember whether this
is the first set operation or have an API to query whether a factor has
already been set.
---
 src/pulsecore/sink-input.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index c6d540e..61a23aa 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1338,7 +1338,11 @@ void pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key) {
     pa_assert_ctl_context();
     pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
 
-    pa_assert_se(v = pa_hashmap_remove(i->volume_factor_items, key));
+    v = pa_hashmap_remove(i->volume_factor_items, key);
+
+    if (!v)
+        return;
+
     volume_factor_entry_free(v);
 
     switch (pa_hashmap_size(i->volume_factor_items)) {
-- 
1.8.2.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux