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

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 8 01:38:56 PDT 2009


Revision: 2763
          http://trac.macosforge.org/projects/ruby/changeset/2763
Author:   lsansonetti at apple.com
Date:     2009-10-08 01:38:52 -0700 (Thu, 08 Oct 2009)
Log Message:
-----------
properly deal with no-bt exceptions

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

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2009-10-08 05:06:12 UTC (rev 2762)
+++ MacRuby/trunk/vm.cpp	2009-10-08 08:38:52 UTC (rev 2763)
@@ -3082,16 +3082,23 @@
     VALUE bt = rb_vm_call(exc, sel_registerName("backtrace"), 0, NULL,
 	    false);
 
-    for (long i = 0, count = RARRAY_LEN(bt); i < count; i++) {
-	const char *bte = RSTRING_PTR(RARRAY_AT(bt, i));
-	if (i == 0) {
-	    printf("%s: %s (%s)\n", bte, RSTRING_PTR(message),
-		    rb_class2name(*(VALUE *)exc));
+    const long count = RARRAY_LEN(bt);
+    if (count > 0) {
+	for (long i = 0; i < count; i++) {
+	    const char *bte = RSTRING_PTR(RARRAY_AT(bt, i));
+	    if (i == 0) {
+		printf("%s: %s (%s)\n", bte, RSTRING_PTR(message),
+			rb_class2name(*(VALUE *)exc));
+	    }
+	    else {
+		printf("\tfrom %s\n", bte);
+	    }
 	}
-	else {
-	    printf("\tfrom %s\n", bte);
-	}
     }
+    else {
+	printf("%s (%s)\n", RSTRING_PTR(message),
+		rb_class2name(*(VALUE *)exc));
+    }
 }
 
 extern "C"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091008/28af7668/attachment.html>


More information about the macruby-changes mailing list