diff --git a/ChangeLog b/ChangeLog index 176b97bdb0..fa969d6230 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jul 16 11:12:03 2013 Masaki Matsushita + + * proc.c (rb_block_arity): raise ArgumentError if no block given. + Tue Jul 16 08:15:22 2013 Zachary Scott * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] document top-level diff --git a/proc.c b/proc.c index 63bed7257e..bcdcb3607c 100644 --- a/proc.c +++ b/proc.c @@ -722,9 +722,11 @@ rb_block_arity(void) rb_thread_t *th = GET_THREAD(); rb_control_frame_t *cfp = th->cfp; rb_block_t *block = rb_vm_control_frame_block_ptr(cfp); - VALUE proc_value = block->proc; + VALUE proc_value; + if (!block) rb_raise(rb_eArgError, "no block given"); min = rb_block_min_max_arity(block, &max); + proc_value = block->proc; if (proc_value) { rb_proc_t *proc; GetProcPtr(proc_value, proc);