diff --git a/include/lang/pattern_data.hpp b/include/lang/pattern_data.hpp index 969413b52..9f6e63e74 100644 --- a/include/lang/pattern_data.hpp +++ b/include/lang/pattern_data.hpp @@ -354,6 +354,9 @@ namespace hex::lang { : PatternData(Type::Array, offset, size, name, endianess, color), m_entries(entries) { } void createEntry(prv::Provider* &provider) override { + if (this->m_entries.empty()) + return; + ImGui::TableNextRow(); ImGui::TableNextColumn(); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); diff --git a/source/lang/evaluator.cpp b/source/lang/evaluator.cpp index d128713e0..8a1f25c02 100644 --- a/source/lang/evaluator.cpp +++ b/source/lang/evaluator.cpp @@ -46,7 +46,7 @@ namespace hex::lang { std::tie(pattern, memberSize) = this->createStringPattern(member, memberOffset); } - else if (member->getArraySize() > 1) { + else if (member->getArraySize() > 1 || member->getVariableType() == Token::TypeToken::Type::Padding) { std::tie(pattern, memberSize) = this->createArrayPattern(member, memberOffset); } else if (member->getArraySizeVariable().has_value()) { @@ -140,7 +140,7 @@ namespace hex::lang { std::tie(pattern, memberSize) = this->createStringPattern(member, memberOffset); } - else if (member->getArraySize() > 1) { + else if (member->getArraySize() > 1 || member->getVariableType() == Token::TypeToken::Type::Padding) { std::tie(pattern, memberSize) = this->createArrayPattern(member, memberOffset); } @@ -277,7 +277,7 @@ namespace hex::lang { delete nonArrayVarDeclNode; } - return { new PatternDataArray(offset, arrayOffset, varDeclNode->getVariableName(), varDeclNode->getEndianess().value_or(this->m_defaultDataEndianess), entries, arrayColor.value()), arrayOffset }; + return { new PatternDataArray(offset, arrayOffset, varDeclNode->getVariableName(), varDeclNode->getEndianess().value_or(this->m_defaultDataEndianess), entries, arrayColor.value_or(0xFF000000)), arrayOffset }; } std::pair Evaluator::createStringPattern(ASTNodeVariableDecl *varDeclNode, u64 offset) {