Browse Source

one more trim fix

David Sehnal 7 years ago
parent
commit
7431964b63
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/reader/common/text/tokenizer.ts

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

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