diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-05-16 00:04:55 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-05-16 00:04:55 +0900 |
| commit | 41b46ca1ed160a014b004223bdceb45d107fecf9 (patch) | |
| tree | cf9565d64fcbab57fd9275ea05bf1d68b48a946b /mrbgems/mruby-proc-ext | |
| parent | 60051de4019b8aab435f6568b960bdeaff4be815 (diff) | |
| download | mruby-41b46ca1ed160a014b004223bdceb45d107fecf9.tar.gz mruby-41b46ca1ed160a014b004223bdceb45d107fecf9.zip | |
register<nlocals may not have a local variable name (e.g. a block arg); fix #2258
Diffstat (limited to 'mrbgems/mruby-proc-ext')
| -rw-r--r-- | mrbgems/mruby-proc-ext/src/proc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mrbgems/mruby-proc-ext/src/proc.c b/mrbgems/mruby-proc-ext/src/proc.c index f0e677045..546ed49e5 100644 --- a/mrbgems/mruby-proc-ext/src/proc.c +++ b/mrbgems/mruby-proc-ext/src/proc.c @@ -142,7 +142,9 @@ mrb_local_variables(mrb_state *mrb, mrb_value self) } ret = mrb_ary_new_capa(mrb, irep->nlocals - 1); for (i = 0; i + 1 < irep->nlocals; ++i) { - mrb_ary_push(mrb, ret, mrb_symbol_value(irep->lv[i].name)); + if (irep->lv[i].name) { + mrb_ary_push(mrb, ret, mrb_symbol_value(irep->lv[i].name)); + } } if (proc->env) { struct REnv *e = proc->env; @@ -152,7 +154,9 @@ mrb_local_variables(mrb_state *mrb, mrb_value self) irep = mrb->c->cibase[e->cioff].proc->body.irep; if (irep->lv) { for (i = 0; i + 1 < irep->nlocals; ++i) { - mrb_ary_push(mrb, ret, mrb_symbol_value(irep->lv[i].name)); + if (irep->lv[i].name) { + mrb_ary_push(mrb, ret, mrb_symbol_value(irep->lv[i].name)); + } } } } |
