1
0
mirror of synced 2025-01-19 01:24:15 +01:00

patterns: Fixed crash when applying certain attributes to types

This commit is contained in:
WerWolv 2022-03-19 00:24:41 +01:00
parent ab5966fa9d
commit 17a2be41da

View File

@ -13,7 +13,7 @@ namespace hex::pl {
ASTNodeTypeDecl(const ASTNodeTypeDecl &other) : ASTNode(other), Attributable(other) {
this->m_name = other.m_name;
this->m_type = other.m_type->clone();
this->m_type = other.m_type;
this->m_endian = other.m_endian;
}
@ -31,8 +31,11 @@ namespace hex::pl {
if (auto attributable = dynamic_cast<Attributable *>(type.get())) {
for (auto &attribute : this->getAttributes()) {
if (auto node = dynamic_cast<ASTNodeAttribute *>(attribute.get()))
auto copy = attribute->clone();
if (auto node = dynamic_cast<ASTNodeAttribute *>(copy.get())) {
attributable->addAttribute(std::unique_ptr<ASTNodeAttribute>(node));
(void)copy.release();
}
}
}