From 8b2dcf976f5c0101ad891f4fc364fc8b55b173a7 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 3 Mar 2022 13:34:05 +0100 Subject: [PATCH] patterns: Fixed auto parameter crash --- lib/libimhex/source/pattern_language/evaluator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libimhex/source/pattern_language/evaluator.cpp b/lib/libimhex/source/pattern_language/evaluator.cpp index 19e212bed..f66a2d2f7 100644 --- a/lib/libimhex/source/pattern_language/evaluator.cpp +++ b/lib/libimhex/source/pattern_language/evaluator.cpp @@ -41,7 +41,9 @@ namespace hex::pl { bool referenceType = false; - if (type == nullptr) { + auto typePattern = type->createPatterns(this); + + if (typePattern.empty()) { // Handle auto variables if (!value.has_value()) LogConsole::abortEvaluation("cannot determine type of auto variable", type); @@ -64,7 +66,7 @@ namespace hex::pl { } else LogConsole::abortEvaluation("cannot determine type of auto variable", type); } else { - pattern = std::move(type->createPatterns(this).front()); + pattern = std::move(typePattern.front()); } pattern->setVariableName(name);