[njs] njs_vm_function() must return only function.

Igor Sysoev igor at sysoev.ru
Fri Jul 22 12:04:47 UTC 2016


details:   http://hg.nginx.org/njs/rev/f59ab0fccecb
branches:  
changeset: 128:f59ab0fccecb
user:      Igor Sysoev <igor at sysoev.ru>
date:      Thu Jul 21 20:51:22 2016 +0300
description:
njs_vm_function() must return only function.

diffstat:

 njs/njs_variable.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 1cfc38ab7ba1 -r f59ab0fccecb njs/njs_variable.c
--- a/njs/njs_variable.c	Thu Jul 21 11:39:00 2016 +0300
+++ b/njs/njs_variable.c	Thu Jul 21 20:51:22 2016 +0300
@@ -139,7 +139,11 @@ njs_vm_function(njs_vm_t *vm, nxt_str_t 
     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;
 }
 
 



More information about the nginx-devel mailing list