Add sanity check to RPNBuilderFunctionTreNode

This commit is contained in:
Robert Schulze 2023-10-22 19:55:17 +00:00
parent 85e3c31f14
commit 77e7f71e02
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A

View File

@ -396,6 +396,12 @@ size_t RPNBuilderFunctionTreeNode::getArgumentsSize() const
RPNBuilderTreeNode RPNBuilderFunctionTreeNode::getArgumentAt(size_t index) const
{
size_t total_arguments = getArgumentsSize();
if (index >= total_arguments)
throw Exception(ErrorCodes::LOGICAL_ERROR,
"RPNBuilderFunctionTreeNode has {} arguments, attempted to get argument at index {}",
total_arguments, index);
if (ast_node)
{
const auto * ast_function = assert_cast<const ASTFunction *>(ast_node);