瀏覽代碼

Fix: fileEqual handling w/ empty line

SukkaW 1 年之前
父節點
當前提交
5dd476cc48
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Build/lib/rules/base.ts

+ 9 - 0
Build/lib/rules/base.ts

@@ -398,6 +398,15 @@ export async function fileEqual(linesA: string[], source: AsyncIterable<string>
 
     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);