aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-23 05:32:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-23 05:32:52 +0000
commitb4b2a21fdfa0aef65caa8dc9fb85ab59f9ddbb53 (patch)
treee3f5238d7814dffc98a11b459ccca13a3a0722b2 /error.c
parentaf07ace39c846e86e3fe0d251e59ba0f684d9953 (diff)
downloadruby-b4b2a21fdfa0aef65caa8dc9fb85ab59f9ddbb53.tar.gz
error.c: ArgumentError if no receiver
* error.c (name_err_receiver): raise ArgumentError if no receiver is available on this exception object. [Feature #10881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/error.c b/error.c
index b668375a55..70ebe6bb67 100644
--- a/error.c
+++ b/error.c
@@ -1264,7 +1264,10 @@ name_err_receiver(VALUE self)
{
VALUE *ptr, mesg = rb_attr_get(self, id_mesg);
- TypedData_Get_Struct(mesg, VALUE, &name_err_mesg_data_type, ptr);
+ if (!rb_typeddata_is_kind_of(mesg, &name_err_mesg_data_type)) {
+ rb_raise(rb_eArgError, "no receiver is available");
+ }
+ ptr = DATA_PTR(mesg);
return ptr[NAME_ERR_MESG__RECV];
}