diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-23 05:32:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-23 05:32:52 +0000 |
commit | c23a7b0db804577b7c30603db6c056385f88cb20 (patch) | |
tree | e3f5238d7814dffc98a11b459ccca13a3a0722b2 /error.c | |
parent | 8283e4fd75362cb452174dc967527cff3e68f9ed (diff) | |
download | ruby-c23a7b0db804577b7c30603db6c056385f88cb20.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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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]; } |