Revision
5278
Author
lsansonetti@apple.com
Date
2011-03-14 19:03:16 -0700 (Mon, 14 Mar 2011)

Log Message

fix a bug where converting a NULL pointer as an opaque type value to Ruby would not give nil (as in RubyCocoa)

Modified Paths

Diff

Modified: MacRuby/trunk/compiler.cpp (5277 => 5278)


--- MacRuby/trunk/compiler.cpp	2011-03-14 18:50:42 UTC (rev 5277)
+++ MacRuby/trunk/compiler.cpp	2011-03-15 02:03:16 UTC (rev 5278)
@@ -5749,6 +5749,9 @@
 VALUE
 rb_vm_new_opaque(VALUE klass, void *val)
 {
+    if (val == NULL) {
+	return Qnil;
+    }
     return Data_Wrap_Struct(klass, NULL, NULL, val);
 }