From 0b720eedcd265e0f837f4de56c1e88278863983c Mon Sep 17 00:00:00 2001 From: 404Simon Date: Thu, 30 May 2024 23:57:34 +0200 Subject: [PATCH] fix main method null check --- src/main/java/de/maishai/ASTGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/maishai/ASTGenerator.java b/src/main/java/de/maishai/ASTGenerator.java index 5635814..cd8380c 100644 --- a/src/main/java/de/maishai/ASTGenerator.java +++ b/src/main/java/de/maishai/ASTGenerator.java @@ -28,7 +28,7 @@ public class ASTGenerator { constructors.add(new Constructor(ctx.id().IDENTIFIER().getText(), List.of(), new Block(List.of()))); } Block mainmeth = null; - if (ctx.mainmeth() != null) { + if (ctx.mainmeth().isEmpty()) { if (ctx.mainmeth().size() > 1) { throw new RuntimeException("Only one main method allowed!"); }