summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c
index d1c68b58f3..215db50080 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -574,6 +574,9 @@ rb_undef(VALUE klass, ID id)
{
rb_method_entry_t *me;
+ if (NIL_P(klass)) {
+ rb_raise(rb_eTypeError, "no class to undef method");
+ }
if (rb_vm_cbase() == rb_cObject && klass == rb_cObject) {
rb_secure(4);
}