diff --git a/src/main/java/net/pixaurora/janerator/graphing/variable/VariableDefinition.java b/src/main/java/net/pixaurora/janerator/graphing/variable/VariableDefinition.java index 49a8ffb..ff63c86 100644 --- a/src/main/java/net/pixaurora/janerator/graphing/variable/VariableDefinition.java +++ b/src/main/java/net/pixaurora/janerator/graphing/variable/VariableDefinition.java @@ -3,7 +3,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.stream.Stream; import org.mariuszgromada.math.mxparser.Expression; @@ -39,8 +38,7 @@ public static VariableDefinition fromString(Map functionTable, Expression expression = new Expression(expressionText); List requiredVariables = Stream.of(expression.getMissingUserDefinedArguments()) - .map(requiredName -> variableTable.get(requiredName)) - .map(variable -> Objects.nonNull(variable) ? variable : new MissingVariable(name)) + .map(requiredName -> variableTable.getOrDefault(requiredName, new MissingVariable(requiredName))) .toList(); List missingVariables = requiredVariables.stream()