Fix the spacebars compiler crash on unterminated string literal

Fixes #4529
This commit is contained in:
Slava Kim
2015-06-10 14:27:10 -07:00
parent e0aa235521
commit ec0608a36e
2 changed files with 5 additions and 1 deletions

View File

@@ -71,4 +71,8 @@ Tinytest.add("blaze-tools - token parsers", function (test) {
runValue(parseStringLiteral, "'\\\\'", '\\');
runValue(parseStringLiteral, "'\\\"'", '\"');
runValue(parseStringLiteral, "'\\\''", '\'');
test.throws(function () {
run(parseStringLiteral, "'this is my string");
}, /Unterminated string literal/);
});

View File

@@ -183,7 +183,7 @@ BlazeTools.parseStringLiteral = function (scanner) {
}
}
if (match[0] !== quote)
if (! match || match[0] !== quote)
scanner.fatal("Unterminated string literal");
jsonLiteral += '"';