From c18414ee5896059bf5654bf13eb605932ecc48d0 Mon Sep 17 00:00:00 2001 From: Shogo Nakamura <104970808+nakaterm@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:11:27 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A5=E7=A8=8B=E7=AF=84=E5=9B=B2?= =?UTF-8?q?=E5=A4=96=E3=82=B9=E3=83=AD=E3=83=83=E3=83=88=E3=81=AB=E3=82=88?= =?UTF-8?q?=E3=82=8B=E3=82=AB=E3=83=AC=E3=83=B3=E3=83=80=E3=83=BC=E6=8F=8F?= =?UTF-8?q?=E7=94=BB=E3=82=AF=E3=83=A9=E3=83=83=E3=82=B7=E3=83=A5=E3=82=92?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=20(#91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/lib/CalendarMatrix.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/lib/CalendarMatrix.ts b/client/src/lib/CalendarMatrix.ts index cb24741..593d892 100644 --- a/client/src/lib/CalendarMatrix.ts +++ b/client/src/lib/CalendarMatrix.ts @@ -34,8 +34,13 @@ abstract class CalendarMatrixBase { return [dayDiff, Math.floor(totalMinutes / 15)]; } + protected isInBounds(row: number, col: number): boolean { + return row >= 0 && row < this.matrix.length && col >= 0 && col < this.quarterCount; + } + getIsSlotExist(dt: Dayjs): boolean { const [row, col] = this.getIndex(dt); + if (!this.isInBounds(row, col)) return false; return this.matrix[row][col] !== null; } @@ -44,6 +49,7 @@ abstract class CalendarMatrixBase { const [endRow, endCol] = this.getIndex(to.subtract(1, "minute")); for (let r = startRow; r <= endRow; r++) { for (let c = startCol; c <= endCol; c++) { + if (!this.isInBounds(r, c)) continue; this.matrix[r][c] = newValue; } } @@ -89,6 +95,7 @@ export class ViewingMatrix extends CalendarMatrixBase> { const [endRow, endCol] = this.getIndex(to.subtract(1, "minute")); for (let r = startRow; r <= endRow; r++) { for (let c = startCol; c <= endCol; c++) { + if (!this.isInBounds(r, c)) continue; if (this.matrix[r][c] === null) { this.matrix[r][c] = {}; }