summaryrefslogtreecommitdiffstats
path: root/vm_method.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-18 01:13:54 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-18 01:13:54 +0000
commitc50d4d71536eac41d807394f4f5fa679431fce51 (patch)
tree28d6e85f2ff67358bad3577411c5cf1f6a828ca2 /vm_method.c
parent1d4d4dab7c6883b070208ac5de05d1a5163e5b4d (diff)
downloadruby-c50d4d71536eac41d807394f4f5fa679431fce51.tar.gz
ruby-c50d4d71536eac41d807394f4f5fa679431fce51.tar.xz
ruby-c50d4d71536eac41d807394f4f5fa679431fce51.zip
* vm_method.c (rb_undef): should raise TypeError if klass is nil.
1.instance_eval { undef to_s } causes SEGV before this fix. * test/ruby/test_undef.rb: new tests for undef. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 d1c68b58f..215db5008 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);
}