[macruby-changes] [3074] MacRuby/trunk/vm.cpp

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 3 18:40:56 PST 2009


Revision: 3074
          http://trac.macosforge.org/projects/ruby/changeset/3074
Author:   emoy at apple.com
Date:     2009-12-03 18:40:54 -0800 (Thu, 03 Dec 2009)
Log Message:
-----------
Fix crash:
    macruby -e 'NSArray.arrayWithObject("a").addObject("b")'
due to backtrace failing, and returning Qnil, which was previous passed to
RSTRING_PTR.

Modified Paths:
--------------
    MacRuby/trunk/vm.cpp

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2009-12-03 11:07:07 UTC (rev 3073)
+++ MacRuby/trunk/vm.cpp	2009-12-04 02:40:54 UTC (rev 3074)
@@ -3573,7 +3573,7 @@
     VALUE bt = rb_vm_call(exc, sel_registerName("backtrace"), 0, NULL,
 	    false);
 
-    const long count = RARRAY_LEN(bt);
+    const long count = (bt != Qnil ? RARRAY_LEN(bt) : 0);
     if (count > 0) {
 	for (long i = 0; i < count; i++) {
 	    const char *bte = RSTRING_PTR(RARRAY_AT(bt, i));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091203/c74af8c5/attachment.html>


More information about the macruby-changes mailing list