From 89a5d21de2796e4a9e764021c20e2b5044b1b8e9 Mon Sep 17 00:00:00 2001 From: Luro02 <24826124+Luro02@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:19:31 +0100 Subject: [PATCH] fix crash in `LeakedCollectionCheck` --- .../autograder/core/check/oop/LeakedCollectionCheck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/LeakedCollectionCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/LeakedCollectionCheck.java index 8ca12338..7b27b40b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/LeakedCollectionCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/LeakedCollectionCheck.java @@ -300,7 +300,7 @@ private void checkCtExecutableReturn(CtExecutable ctExecutable) { // a lambda like () -> true does not have a body, but an expression which is a return statement // this case is handled here - if (statements.isEmpty() && ctExecutable instanceof CtLambda ctLambda) { + if (statements.isEmpty() && ctExecutable instanceof CtLambda ctLambda && ctLambda.getExpression() != null) { statements = List.of(createCtReturn(ctLambda.getExpression().clone())); }