From 7317bda66a937464e733e4356ee1f3db3cb005f0 Mon Sep 17 00:00:00 2001 From: glass Date: Tue, 16 Jul 2013 02:22:17 +0000 Subject: [PATCH] * proc.c (rb_block_arity): raise ArgumentError if no block given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ proc.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) 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);