fix issue #5012 - Cannot read property 'declarations' of null (#5019)

- temporary fix
This commit is contained in:
Jason Aslakson
2017-01-19 21:36:18 -05:00
committed by Henry Zhu
parent e9fc38bcd3
commit ef25bebfa8
4 changed files with 36 additions and 1 deletions

View File

@@ -121,7 +121,12 @@ export default class PathHoister {
do {
if (!path.parentPath ||
(Array.isArray(path.container) && path.isStatement()) ||
(path.isVariableDeclarator() && path.parentPath.node.declarations.length > 1))
(
path.isVariableDeclarator() &&
path.parentPath.node !== null &&
path.parentPath.node.declarations.length > 1
)
)
return path;
} while ((path = path.parentPath));
}