aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-03 17:04:51 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-03 17:04:51 +0000
commit70b4db1f639aa0be603c986d34f8a25d2abdef2f (patch)
tree8477592d6d084c4eb5321bc26d69c20b61a92fde /res/res_musiconhold.c
parent64153a769aff5f108d5a53e0c925d29178edd477 (diff)
when using moh files mode, don't look for a file past the number of files
that have been loaded, or worse, past the size of the files array git-svn-id: http://svn.digium.com/svn/asterisk/trunk@31776 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 15267d487..17ee7f5f1 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -218,6 +218,8 @@ static int ast_moh_files_next(struct ast_channel *chan)
if (ast_test_flag(state->class, MOH_RANDOMIZE))
state->pos = ast_random();
+ state->pos %= state->class->total_files;
+
/* check to see if this file's format can be opened */
if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) != -1)
break;