mirror of https://github.com/WerWolv/ImHex.git
patterns: Fixed crash when using control flow statements without value
Fixes #460
This commit is contained in:
parent
2a989c6cc1
commit
775b3e8c52
|
@ -34,12 +34,14 @@ namespace hex::pl {
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionResult execute(Evaluator *evaluator) const override {
|
FunctionResult execute(Evaluator *evaluator) const override {
|
||||||
auto returnValue = this->m_rvalue->evaluate(evaluator);
|
|
||||||
|
|
||||||
auto literal = dynamic_cast<ASTNodeLiteral *>(returnValue.get());
|
|
||||||
|
|
||||||
evaluator->setCurrentControlFlowStatement(this->m_type);
|
evaluator->setCurrentControlFlowStatement(this->m_type);
|
||||||
|
|
||||||
|
if (this->m_rvalue == nullptr)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
auto returnValue = this->m_rvalue->evaluate(evaluator);
|
||||||
|
auto literal = dynamic_cast<ASTNodeLiteral *>(returnValue.get());
|
||||||
|
|
||||||
if (literal == nullptr)
|
if (literal == nullptr)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue