diff --git a/main/pbx.c b/main/pbx.c index a26bad92f5..534dc4c0b4 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -6775,11 +6775,10 @@ static unsigned get_range(char *src, int max, char *const names[], const char *m /* Fill the mask. Remember that ranges are cyclic */ mask |= (1 << end); /* initialize with last element */ while (start != end) { - if (start >= max) { + mask |= (1 << start); + if (++start >= max) { start = 0; } - mask |= (1 << start); - start++; } } return mask;