diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsFrontendCompiler.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsFrontendCompiler.java index 2a190660..a996f32e 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsFrontendCompiler.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsFrontendCompiler.java @@ -248,6 +248,9 @@ public final class PbsFrontendCompiler { private void collectCallsFromBlock( final PbsAst.Block block, final List output) { + if (block == null) { + return; + } for (final var statement : block.statements()) { collectCallsFromStatement(statement, output); } @@ -259,6 +262,9 @@ public final class PbsFrontendCompiler { private void collectCallsFromStatement( final PbsAst.Statement statement, final List output) { + if (statement == null) { + return; + } switch (statement) { case PbsAst.LetStatement letStatement -> collectCallsFromExpression(letStatement.initializer(), output); case PbsAst.AssignStatement assignStatement -> collectCallsFromExpression(assignStatement.value(), output); @@ -301,6 +307,9 @@ public final class PbsFrontendCompiler { private void collectCallsFromExpression( final PbsAst.Expression expression, final List output) { + if (expression == null) { + return; + } switch (expression) { case PbsAst.CallExpr callExpr -> { output.add(callExpr);