From e1a5492a7fc8cf27b9b7d6d9ba06700030a2e449 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 11 Jan 2015 22:27:12 +0400 Subject: [PATCH] do not throw error when trying to match tag at the end of the document --- lib/ace/editor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 3bb2c0e4..5f9d10be 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -545,9 +545,12 @@ var Editor = function(renderer, session) { return; } - if (token.type.indexOf("tag-open") != -1) + if (token.type.indexOf("tag-open") != -1) { token = iterator.stepForward(); - + if (!token) + return; + } + var tag = token.value; var depth = 0; var prevToken = iterator.stepBackward();