aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/res_musiconhold.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 2a27dcec8..97ae3d871 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -778,6 +778,11 @@ static int moh_scan_files(struct mohclass *class) {
if (i == class->total_files)
strcpy(class->filearray[class->total_files++], filepath);
+
+ /* If the new total files is equal to the maximum allowed, stop adding new ones */
+ if (class->total_files == MAX_MOHFILES)
+ break;
+
}
closedir(files_DIR);