ruby-changes:38921
From: nobu <ko1@a...>
Date: Tue, 23 Jun 2015 14:32:59 +0900 (JST)
Subject: [ruby-changes:38921] nobu:r51002 (trunk): error.c: ArgumentError if no receiver
nobu 2015-06-23 14:32:52 +0900 (Tue, 23 Jun 2015) New Revision: 51002 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51002 Log: error.c: ArgumentError if no receiver * error.c (name_err_receiver): raise ArgumentError if no receiver is available on this exception object. [Feature #10881] Modified files: trunk/ChangeLog trunk/error.c Index: ChangeLog =================================================================== --- ChangeLog (revision 51001) +++ ChangeLog (revision 51002) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jun 23 14:32:42 2015 Nobuyoshi Nakada <nobu@r...> + + * error.c (name_err_receiver): raise ArgumentError if no receiver + is available on this exception object. [Feature #10881] + Tue Jun 23 09:48:34 2015 Eric Wong <e@8...> * dir.c (check_dirname): avoid volatile, use return value Index: error.c =================================================================== --- error.c (revision 51001) +++ error.c (revision 51002) @@ -1264,7 +1264,10 @@ name_err_receiver(VALUE self) https://github.com/ruby/ruby/blob/trunk/error.c#L1264 { 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]; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/