Fix #14892: Add undefined check before using the intializer of for-statement

This commit is contained in:
Mohamed Hegazy
2017-03-28 10:06:36 -07:00
parent 0fd0903280
commit 115c008694
5 changed files with 245 additions and 1 deletions

View File

@@ -1478,7 +1478,7 @@ namespace ts {
}
const initializer = node.initializer;
if (isVariableDeclarationList(initializer)) {
if (initializer && isVariableDeclarationList(initializer)) {
for (const variable of initializer.declarations) {
hoistVariableDeclaration(<Identifier>variable.name);
}