Revision
5221
Author
lsansonetti@apple.com
Date
2011-02-07 14:05:12 -0800 (Mon, 07 Feb 2011)

Log Message

fix a bug in Thread.kill when passing a non-Thread object would cause a crash

Modified Paths

Diff

Modified: MacRuby/trunk/thread.c (5220 => 5221)


--- MacRuby/trunk/thread.c	2011-02-04 02:24:53 UTC (rev 5220)
+++ MacRuby/trunk/thread.c	2011-02-07 22:05:12 UTC (rev 5221)
@@ -377,6 +377,10 @@
 static VALUE
 rb_thread_s_kill(VALUE obj, SEL sel, VALUE th)
 {
+    if (!rb_obj_is_kind_of(th, rb_cThread)) {
+	rb_raise(rb_eTypeError, "wrong argument type %s (expected Thread)",
+		rb_obj_classname(th));
+    }
     return rb_thread_kill(th, 0);
 }