From e23f90e41c177552aa7e1bde98c6ba1b7acb9d4f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 30 Jan 2019 13:31:01 +0100 Subject: Fix the cannot read property range of null bug --- packages/sol-tracing-utils/CHANGELOG.json | 4 ++++ packages/sol-tracing-utils/src/ast_visitor.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/sol-tracing-utils/CHANGELOG.json b/packages/sol-tracing-utils/CHANGELOG.json index 16a12ca63..024e896da 100644 --- a/packages/sol-tracing-utils/CHANGELOG.json +++ b/packages/sol-tracing-utils/CHANGELOG.json @@ -17,6 +17,10 @@ { "note": "Print resasonable error message on bytecode collision", "pr": 1535 + }, + { + "note": "Fix the bug in `ASTVisitor` causing the 'cannot read property `range` of `null`' error", + "pr": 1557 } ] }, diff --git a/packages/sol-tracing-utils/src/ast_visitor.ts b/packages/sol-tracing-utils/src/ast_visitor.ts index 1ac9cd1de..27f19378b 100644 --- a/packages/sol-tracing-utils/src/ast_visitor.ts +++ b/packages/sol-tracing-utils/src/ast_visitor.ts @@ -89,7 +89,9 @@ export class ASTVisitor { this._visitStatement(ast); } public ExpressionStatement(ast: Parser.ExpressionStatement): void { - this._visitStatement(ast.expression); + if (!_.isNull(ast.expression)) { + this._visitStatement(ast.expression); + } } public InlineAssemblyStatement(ast: Parser.InlineAssemblyStatement): void { this._visitStatement(ast); -- cgit v1.2.3