Skip to content

Commit

Permalink
safeguard against undefined chunk, close #129 (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Mar 16, 2018
1 parent aedc0e1 commit 58a0d65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MagicString.js
Expand Up @@ -525,7 +525,7 @@ export default class MagicString {
let chunk = this.lastSearchedChunk;
const searchForward = index > chunk.end;

while (true) {
while (chunk) {
if (chunk.contains(index)) return this._splitChunk(chunk, index);

chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
Expand Down

0 comments on commit 58a0d65

Please sign in to comment.