From bdb693302a7cc107b8b762686c005f64bb12f302 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 3 May 2024 05:19:35 -0300 Subject: [PATCH] Copy Array -> Use for loop with len --- scripts/generateReport.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts index 2af192ff3..9875fb749 100644 --- a/scripts/generateReport.ts +++ b/scripts/generateReport.ts @@ -471,9 +471,13 @@ async function runtime(token: string) { } } - for (const [searchType, args] of [...Vencord.Webpack.webpackSearchHistory]) { - let method = searchType as string; + // Must evaluate the len outside of the loop, as the array will be modified by the find methods called inside of it + // This will avoid an infinite loop + const len = Vencord.Webpack.webpackSearchHistory.length; + for (let i = 0; i < len; i++) { + const [searchType, args] = Vencord.Webpack.webpackSearchHistory[i]; + let method = searchType as string; if (searchType === "waitFor") method = "cacheFind"; try {