summaryrefslogtreecommitdiffhomepage
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index d6094ca..18fdf3c 100644
--- a/eval.c
+++ b/eval.c
@@ -1069,7 +1069,9 @@ ut_invoke(struct ut_state *state, uint32_t off, struct json_object *scope,
/* store the function "this" context in the proto member of the scope tag structure */
tag = json_object_get_userdata(s);
- tag->tag.proto = json_object_get(state->ctx);
+
+ if (tag)
+ tag->tag.proto = json_object_get(state->ctx);
rv = ut_execute_op_sequence(state, decl->tree.operand[2]);
tag = json_object_get_userdata(rv);
@@ -1097,8 +1099,11 @@ ut_invoke(struct ut_state *state, uint32_t off, struct json_object *scope,
/* we left the function, remove the "this" context from the scope tag structure */
tag = json_object_get_userdata(s);
- json_object_put(tag->tag.proto);
- tag->tag.proto = NULL;
+
+ if (tag) {
+ json_object_put(tag->tag.proto);
+ tag->tag.proto = NULL;
+ }
if (!scope) {
state->stack.scope[--state->stack.off] = NULL;