aboutsummaryrefslogtreecommitdiffstats
path: root/vm_method.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index 66c783ce2a..e3c365dd42 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1859,7 +1859,9 @@ rb_mod_modfunc(int argc, VALUE *argv, VALUE module)
int
rb_method_basic_definition_p(VALUE klass, ID id)
{
- const rb_method_entry_t *me = rb_method_entry(klass, id);
+ const rb_method_entry_t *me;
+ if (!klass) return TRUE; /* hidden object cannot be overridden */
+ me = rb_method_entry(klass, id);
return (me && METHOD_ENTRY_BASIC(me)) ? TRUE : FALSE;
}