aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-03 17:02:49 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-03 17:02:49 +0000
commit2b0b0df6b295bf89bf6f1495ad0ed7f1b3201cd5 (patch)
treea3256f6292e799ea3e6b47dbce6d8cbb4ae6513e /res
parentba74f23e5ad46115ceaab9a813aa15291bc85374 (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/branches/1.2@31775 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-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 8f4ef33d2..faa823e10 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -212,6 +212,8 @@ static int ast_moh_files_next(struct ast_channel *chan)
if (ast_test_flag(state->class, MOH_RANDOMIZE))
state->pos = rand();
+ 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;