--- ../asterisk.official.1.4/res/res_musiconhold.c 2007-10-02 18:58:07.441406461 -0300 +++ res/res_musiconhold.c 2007-10-11 12:41:14.295985845 -0300 @@ -231,6 +231,10 @@ chan->stream = NULL; } + /* Only look for the next file if there is at least one file in the music class */ + if (state->class->total_files > 0) { + return -1; + } /* If a specific file has been saved, use it */ if (state->save_pos >= 0) { state->pos = state->save_pos;