Revision: 2763 http://trac.macosforge.org/projects/ruby/changeset/2763 Author: lsansonetti@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"
participants (1)
-
source_changes@macosforge.org