From 9c5890a1383b9021a0ae8097e46b6f4ab81496ae Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 3 Jun 2006 17:02:49 +0000 Subject: [PATCH] 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: https://origsvn.digium.com/svn/asterisk/branches/1.2@31775 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_musiconhold.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 8f4ef33d2a..faa823e108 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; -- 2.47.2