diff --git a/src/main/java/de/maishai/ExpressionGenerator.java b/src/main/java/de/maishai/ExpressionGenerator.java index d5d87cb..3701aec 100644 --- a/src/main/java/de/maishai/ExpressionGenerator.java +++ b/src/main/java/de/maishai/ExpressionGenerator.java @@ -106,9 +106,11 @@ public class ExpressionGenerator extends DecafBaseVisitor { public Expression visitNew(DecafParser.NewContext ctx) { Type type = ASTGenerator.getType(ctx.type()); List args = new ArrayList<>(); - for (var expr : ctx.args().expr()) { - Expression astExpr = expr.accept(this); - args.add(astExpr); + if (ctx.args() != null) { + for (var expr : ctx.args().expr()) { + Expression astExpr = expr.accept(this); + args.add(astExpr); + } } return new New(type, args); }