diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index 3e1775a0d..e815ee39b 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -1138,6 +1138,8 @@ namespace hex::pl { auto pattern = new PatternDataPointer(offset, sizePattern->getSize(), evaluator); pattern->setVariableName(this->m_name); + applyVariableAttributes(evaluator, this, pattern); + offset = evaluator->dataOffset(); { @@ -1155,8 +1157,6 @@ namespace hex::pl { evaluator->dataOffset() = offset; - applyVariableAttributes(evaluator, this, pattern); - return { pattern }; } diff --git a/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp b/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp index dddd02cb1..efb72976b 100644 --- a/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp +++ b/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp @@ -440,12 +440,14 @@ namespace hex::pl { } void rebase(u64 base) { - this->m_pointedAt->setOffset((this->m_pointedAt->getOffset() - this->m_pointerBase) + base); + if (this->m_pointedAt != nullptr) + this->m_pointedAt->setOffset((this->m_pointedAt->getOffset() - this->m_pointerBase) + base); + this->m_pointerBase = base; } private: - PatternData *m_pointedAt; + PatternData *m_pointedAt = nullptr; u64 m_pointerBase = 0; };