Revision
4336
Author
martinlagardette@apple.com
Date
2010-07-08 16:55:33 -0700 (Thu, 08 Jul 2010)

Log Message

`IO#syswrite`: Always check if there is a buffer before getting it's length

 - Fixes #778

Modified Paths

Diff

Modified: MacRuby/trunk/io.c (4335 => 4336)


--- MacRuby/trunk/io.c	2010-07-08 23:45:37 UTC (rev 4335)
+++ MacRuby/trunk/io.c	2010-07-08 23:55:33 UTC (rev 4336)
@@ -400,7 +400,7 @@
 
     data = rb_str_bstr(rb_obj_as_string(data));
     
-    if (CFDataGetLength(io_struct->buf) > 0) {
+    if (io_struct->buf && CFDataGetLength(io_struct->buf) > 0) {
 	rb_warn("Calling #syswrite on buffered I/O may lead to unexpected results");
     }