From e7db13071696278e01558eb4392426cd9e5ec7ee Mon Sep 17 00:00:00 2001 From: sashaodessa <140454972+sashaodessa@users.noreply.github.com> Date: Wed, 22 Oct 2025 18:54:50 +0200 Subject: [PATCH] Update circularSlice.ts --- apps/website/src/utils/circularSlice.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/website/src/utils/circularSlice.ts b/apps/website/src/utils/circularSlice.ts index 2df198de9..15d349269 100644 --- a/apps/website/src/utils/circularSlice.ts +++ b/apps/website/src/utils/circularSlice.ts @@ -10,6 +10,10 @@ * @returns A new array containing the extracted elements. */ export function circularSlice(list: any[], index: number, numberOfItems: number): any[] { + // Return empty array for empty input or non-positive count to avoid NaN index access + if (list.length === 0 || numberOfItems <= 0) { + return [] + } const result = [] for (let i = 0; i < numberOfItems; i += 1) {