From 5dd476cc480bb094cf54dfb39bc1bb4c3dd9ef26 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sat, 18 Jan 2025 03:05:17 +0800 Subject: [PATCH] Fix: fileEqual handling w/ empty line --- Build/lib/rules/base.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Build/lib/rules/base.ts b/Build/lib/rules/base.ts index 1f74712a..c1c7fef1 100644 --- a/Build/lib/rules/base.ts +++ b/Build/lib/rules/base.ts @@ -398,6 +398,15 @@ export async function fileEqual(linesA: string[], source: AsyncIterable const lineA = linesA[index]; + if (lineA.length === 0 && lineB.length === 0) { + continue; + } + + // not both line are empty + if (lineA.length === 0 || lineB.length === 0) { + return false; + } + const firstCharA = lineA.charCodeAt(0); const firstCharB = lineB.charCodeAt(0);