summaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index e73ba39d6..a49926bef 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);