]> git.kaiwu.me - njs.git/commitdiff
njs_vm_function() must return only function.
authorIgor Sysoev <igor@sysoev.ru>
Thu, 21 Jul 2016 17:51:22 +0000 (20:51 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 21 Jul 2016 17:51:22 +0000 (20:51 +0300)
njs/njs_variable.c

index a102a309c905cd64016a281bc92d85696ae761ec..7ad8c6b868f5ddfaa30f3081c34fbca539294c49 100644 (file)
@@ -139,7 +139,11 @@ njs_vm_function(njs_vm_t *vm, nxt_str_t *name)
     value = (njs_value_t *) ((u_char *) vm->global_scope
                            + njs_offset(var->index) - NJS_INDEX_GLOBAL_OFFSET);
 
-    return value->data.u.function;
+    if (njs_is_function(value)) {
+        return value->data.u.function;
+    }
+
+    return NULL;
 }