]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
ast_call_check_types should not check more parameters than actually available in...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Mon, 29 Oct 2012 13:35:50 +0000 (14:35 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Mon, 29 Oct 2012 13:35:50 +0000 (14:35 +0100)
ast.c

diff --git a/ast.c b/ast.c
index d8ca8bd96cb8a6083ecbbe21fcc8f2840a07244b..5ec1d3a20c2aac131488889502f0e845b9d6c847 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -674,9 +674,12 @@ bool ast_call_check_types(ast_call *self)
 {
     size_t i;
     bool   retval = true;
-    const ast_expression *func = self->func;
+    const  ast_expression *func = self->func;
+    size_t count = self->params_count;
+    if (count > func->expression.params_count)
+        count = func->expression.params_count;
 
-    for (i = 0; i < self->params_count; ++i) {
+    for (i = 0; i < count; ++i) {
         if (!ast_compare_type(self->params[i], (ast_expression*)(func->expression.params[i]))) {
             asterror(ast_ctx(self), "invalid type for parameter %u in function call",
                      (unsigned int)(i+1));