From 2fd1c7565bdc2c631e66fc83c54b8698edd4d4b2 Mon Sep 17 00:00:00 2001 From: okonomiyaki3000 Date: Fri, 16 Dec 2011 15:05:22 +0900 Subject: [PATCH] Problem: It seems that, under circumstances I do not understand, some NaN value gets passed to getState and then on to $tokenizeRows which causes empty array to be returned. getState then tries to access element 0 of this array and ugly things start to happen. Solution: never return empty array from $tokenizeRows --- lib/ace/background_tokenizer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ace/background_tokenizer.js b/lib/ace/background_tokenizer.js index 0ee8990c..e5fe73bd 100644 --- a/lib/ace/background_tokenizer.js +++ b/lib/ace/background_tokenizer.js @@ -130,8 +130,8 @@ var BackgroundTokenizer = function(tokenizer, editor) { }; this.$tokenizeRows = function(firstRow, lastRow) { - if (!this.doc) - return []; + if (!this.doc || isNaN(firstRow) || isNaN(lastRow)) + return [{'state':'start','tokens':[]}]; var rows = [];