From b59155af7dda49e18f64a9b76dfcd350fb4e6198 Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Tue, 11 Jan 2011 09:20:57 +0100 Subject: [PATCH] Fix bug in Document.. If there are no lines after trimming off the spaces/tabs from the end return directly. --- lib/ace/document.js | 6 ++++++ 1 file changed, 6 insertions(+) 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"