From 25d6f45329b4395218e33917967e0329e2d86cc1 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 6 Apr 2023 23:32:30 +0200 Subject: [PATCH] AST: Do not try to store nullptr in a Collection or HashMap --- src/ast.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ast.cpp b/src/ast.cpp index e83a52b..f1930fc 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -18,6 +18,10 @@ namespace blaze { void Collection::add(ASTNodePtr node) { + if (node == nullptr) { + return; + } + m_nodes.push_back(node); } @@ -25,6 +29,10 @@ void Collection::add(ASTNodePtr node) void HashMap::add(const std::string& key, ASTNodePtr value) { + if (value == nullptr) { + return; + } + m_elements.emplace(key, value); }