From: Russell Bryant Date: Sat, 3 Jun 2006 17:04:51 +0000 (+0000) Subject: when using moh files mode, don't look for a file past the number of files X-Git-Tag: 1.4.0-beta1~1095 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61d295f18740695b3840440855a0ca0b928ebb95;p=thirdparty%2Fasterisk.git 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/trunk@31776 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 15267d4878..17ee7f5f1f 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;