diff --git a/lib/ace/document.js b/lib/ace/document.js index 2138f234..22b5cb4e 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -879,6 +879,12 @@ var Document = function(text, mode) { } tabLine.splice(toRemove + 1); + // Shortcut: If there are no more tabLines, then there is nothing to + // split up. + if (tabLine.length == 0) { + return []; + } + // Remove spaces from the last tabLine to prevent splits only for // whitespaces as well. // E.g: "foo \tbar " -> "foo \tbar"