David Sehnal 7 年之前
父節點
當前提交
063be5b225
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/reader/common/text/tokenizer.ts

+ 1 - 1
src/reader/common/text/tokenizer.ts

@@ -122,7 +122,7 @@ export function trim(state: State, start: number, end: number) {
     let c = data.charCodeAt(s);
     while (c === 9 || c === 32) c = data.charCodeAt(++s);
     c = data.charCodeAt(e);
-    while (c === 9 || c === 32) c = data.charCodeAt(--e);
+    while ((c === 9 || c === 32) && e >= s) c = data.charCodeAt(--e);
 
     state.currentTokenStart = s;
     state.currentTokenEnd = e + 1;