diff --git a/lib/libimhex/include/hex/pattern_language/ast/ast_node_control_flow_statement.hpp b/lib/libimhex/include/hex/pattern_language/ast/ast_node_control_flow_statement.hpp index 1eb428fb1..ce7f400af 100644 --- a/lib/libimhex/include/hex/pattern_language/ast/ast_node_control_flow_statement.hpp +++ b/lib/libimhex/include/hex/pattern_language/ast/ast_node_control_flow_statement.hpp @@ -34,12 +34,14 @@ namespace hex::pl { } FunctionResult execute(Evaluator *evaluator) const override { - auto returnValue = this->m_rvalue->evaluate(evaluator); - - auto literal = dynamic_cast(returnValue.get()); - evaluator->setCurrentControlFlowStatement(this->m_type); + if (this->m_rvalue == nullptr) + return std::nullopt; + + auto returnValue = this->m_rvalue->evaluate(evaluator); + auto literal = dynamic_cast(returnValue.get()); + if (literal == nullptr) return std::nullopt; else