Revision
4358
Author
martinlagardette@apple.com
Date
2010-07-13 15:49:49 -0700 (Tue, 13 Jul 2010)

Log Message

Fix `#marshal_load` for non-array arguments

 - Fixes <rdar://problem/8164079>

Modified Paths

Diff

Modified: MacRuby/trunk/complex.c (4357 => 4358)


--- MacRuby/trunk/complex.c	2010-07-13 22:37:13 UTC (rev 4357)
+++ MacRuby/trunk/complex.c	2010-07-13 22:49:49 UTC (rev 4358)
@@ -1324,9 +1324,10 @@
 nucomp_marshal_load(VALUE self, SEL sel, VALUE a)
 {
     get_dat1(self);
-    GC_WB(&dat->real, RARRAY_AT(a, 0));
-    GC_WB(&dat->imag, RARRAY_AT(a, 1));
-    rb_copy_generic_ivar(self, a);
+    VALUE ary = rb_convert_type(a, T_ARRAY, "Array", "to_ary");
+    GC_WB(&dat->real, RARRAY_AT(ary, 0));
+    GC_WB(&dat->imag, RARRAY_AT(ary, 1));
+    rb_copy_generic_ivar(self, ary);
     return self;
 }