Skip to content

Commit

Permalink
find_lex_by_name can return NULL, check for it
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Jan 30, 2014
1 parent 96dc4ea commit d44d015
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/core/interp.c
Expand Up @@ -247,11 +247,17 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
MVM_reg_str)->s = GET_REG(cur_op, 4).s;
cur_op += 6;
goto NEXT;
OP(bindlex_no):
MVM_frame_find_lexical_by_name(tc, cu->body.strings[GET_UI32(cur_op, 0)],
MVM_reg_obj)->o = GET_REG(cur_op, 4).o;
OP(bindlex_no): {
MVMString *str = cu->body.strings[GET_UI32(cur_op, 0)];
MVMRegister *r = MVM_frame_find_lexical_by_name(tc, str, MVM_reg_obj);
if (r)
r->o = GET_REG(cur_op, 4).o;
else
MVM_exception_throw_adhoc(tc, "Cannot bind to non-existing object lexical '%s'",
MVM_string_utf8_encode_C_string(tc, str));
cur_op += 6;
goto NEXT;
}
OP(getlex_ng):
OP(bindlex_ng):
MVM_exception_throw_adhoc(tc, "get/bindlex_ng NYI");
Expand Down

0 comments on commit d44d015

Please sign in to comment.