Skip to content

Commit

Permalink
fix NPE due the jcVariableDecl.vartype being null
Browse files Browse the repository at this point in the history
  • Loading branch information
gayanper committed Jun 8, 2024
1 parent 4ba2fb1 commit 6a634b4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ private Statement convertStatement(JCStatement javac, ASTNode parent) {
if (javac instanceof JCVariableDecl jcVariableDecl) {
VariableDeclarationFragment fragment = createVariableDeclarationFragment(jcVariableDecl);
List<ASTNode> sameStartPosition = new ArrayList<>();
if( parent instanceof Block decl) {
if (parent instanceof Block decl && jcVariableDecl.vartype != null) {
decl.statements().stream().filter(x -> x instanceof VariableDeclarationStatement)
.filter(x -> ((VariableDeclarationStatement)x).getType().getStartPosition() == jcVariableDecl.vartype.getStartPosition())
.forEach(x -> sameStartPosition.add((ASTNode)x));
Expand Down

0 comments on commit 6a634b4

Please sign in to comment.