aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pbx.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/pbx.c b/pbx.c
index b355abe04..197175c1e 100644
--- a/pbx.c
+++ b/pbx.c
@@ -3728,10 +3728,14 @@ static unsigned get_range(char *src, int max, char *const names[], const char *m
}
/* Fill the mask. Remember that ranges are cyclic */
mask = 1 << e; /* initialize with last element */
- for ( ; s != e; s++) {
- if (s == max)
- s = 0 ;
- mask |= (1 << s);
+ while (s != e) {
+ if (s >= max) {
+ s = 0;
+ mask |= (1 << s);
+ } else {
+ mask |= (1 << s);
+ s++;
+ }
}
return mask;
}