AST: Do not try to store nullptr in a Collection or HashMap

This commit is contained in:
Riyyi
2023-04-07 23:38:41 +02:00
parent 835669c4eb
commit 25d6f45329
+8
View File
@@ -18,6 +18,10 @@ namespace blaze {
void Collection::add(ASTNodePtr node) void Collection::add(ASTNodePtr node)
{ {
if (node == nullptr) {
return;
}
m_nodes.push_back(node); m_nodes.push_back(node);
} }
@@ -25,6 +29,10 @@ void Collection::add(ASTNodePtr node)
void HashMap::add(const std::string& key, ASTNodePtr value) void HashMap::add(const std::string& key, ASTNodePtr value)
{ {
if (value == nullptr) {
return;
}
m_elements.emplace(key, value); m_elements.emplace(key, value);
} }