             classPeriod = classPeriod - 2
         }
         // 若课时循环完毕则返回字符串数组
-        if classPeriod == 0 || modelArray.count == 0 {
+        if classPeriod == 0 || modelArray.count == 0 || days.count == 0{
             return timeSchedule
         }
 

        /// 遍历循环次数（除本周外的上课周数）
        var weeks = 1
        for _ in 1...(classPeriod - classArrayInThisWeek.count*2)/2 {
            let model = modelArray[index]
            var date = MalaWeekdays[model.id].dateInThisWeek()
            // 获取到对应的本周日期后，加上对应的周数即为上课时间。
            date = date.dateByAddingWeeks(1*weeks)

            
            // 累加计数器。超出数组下标归零，循环次数+1
            index++
            if index == days.count {
                index = 0
                weeks++
            }
