Browse Source

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

master
Riyyi 2 years ago
parent
commit
25d6f45329
  1. 8
      src/ast.cpp

8
src/ast.cpp

@ -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);
} }

Loading…
Cancel
Save