AST: Do not try to store nullptr in a Collection or HashMap
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user