aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mixer.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mixer.c b/src/mixer.c
index 5581e5d..b4d96fd 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -732,9 +732,13 @@ struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer,
ctl = grp->ctl;
for (n = 0; n < grp->count; n++)
- if (!strcmp(name, (char*) ctl[n].info.id.name))
- if (index-- == 0)
+ if (!strcmp(name, (char*) ctl[n].info.id.name)) {
+ if (index == 0) {
return ctl + n;
+ } else {
+ index--;
+ }
+ }
}
#ifdef TINYALSA_USES_PLUGINS
@@ -743,9 +747,13 @@ struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer,
ctl = grp->ctl;
for (n = 0; n < grp->count; n++)
- if (!strcmp(name, (char*) ctl[n].info.id.name))
- if (index-- == 0)
+ if (!strcmp(name, (char*) ctl[n].info.id.name)) {
+ if (index == 0) {
return ctl + n;
+ } else {
+ index--;
+ }
+ }
}
#endif
return NULL;