From bca5029d8b4e27a8bfb9fa9c42617adeaa23b7d7 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 3 Feb 2009 14:13:36 +0000 Subject: [PATCH] * vm.c (vm_backtrace): always returns non-nil array if lev is negative. [ruby-core:21795] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ vm.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4d8f1bc4e2..98ddd10553 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 3 23:13:34 2009 Nobuyoshi Nakada + + * vm.c (vm_backtrace): always returns non-nil array if lev is + negative. [ruby-core:21795] + Tue Feb 3 21:19:06 2009 TAKAO Kouji * ext/readline/extconf.rb: checked rl_set_screen_size and diff --git a/vm.c b/vm.c index e73ba39d6a..a49926bef1 100644 --- a/vm.c +++ b/vm.c @@ -737,6 +737,9 @@ vm_backtrace(rb_thread_t *th, int lev) { VALUE ary = 0; + if (lev < 0) { + ary = rb_ary_new(); + } vm_backtrace_each(th, lev, vm_backtrace_push, &ary); if (!ary) return Qnil; return rb_ary_reverse(ary);