Skip to content

Commit 4a2f818

Browse files
committed
Fix: ignore out-of-range BlockMasks (#368)
Ignore out-of-range BlockMasks
1 parent bdd280c commit 4a2f818

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

SNUTT-2022/SNUTT/Views/Components/Timetable/TimetableUtils.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ struct TimetablePainter {
226226
var blockMask = Array(repeating: reverse, count: blockMaskSize)
227227
for time in timeMask {
228228
for minute in stride(from: time.startMinute, to: time.endMinute, by: halfHour) {
229+
if minute < startHourOffset || minute > startHourOffset + halfHour * halfHourCount { continue }
229230
let halfHourIndex = Int(floor(Double(minute - startHourOffset) / Double(halfHour)))
230231
blockMask[time.day * halfHourCount + halfHourIndex] = !reverse
231232
}

0 commit comments

Comments
 (0)