aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
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];
}