mirror of
https://github.com/pantor/inja.git
synced 2026-05-19 02:35:23 +00:00
add size check in get_argument_vector
This commit is contained in:
@@ -119,6 +119,10 @@ class Renderer : public NodeVisitor {
|
||||
|
||||
template<bool throw_not_found=true>
|
||||
Arguments get_argument_vector(size_t N, const AstNode& node) {
|
||||
if (json_eval_stack.size() < N) {
|
||||
throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
|
||||
}
|
||||
|
||||
Arguments result {N};
|
||||
for (size_t i = 0; i < N; i += 1) {
|
||||
result[N - i - 1] = json_eval_stack.top();
|
||||
|
||||
Reference in New Issue
Block a user