Skip to content

Commit

Permalink
Check backtrace info may not be set (esp. NoMemError); fix #3663
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed May 25, 2017
1 parent 5e1a6a2 commit e969229
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ mrb_print_backtrace(mrb_state *mrb)
}

backtrace = mrb_obj_iv_get(mrb, mrb->exc, mrb_intern_lit(mrb, "backtrace"));
if (mrb_nil_p(backtrace)) return;
if (mrb_array_p(backtrace)) {
print_backtrace(mrb, backtrace);
}
Expand Down Expand Up @@ -198,6 +199,7 @@ mrb_unpack_backtrace(mrb_state *mrb, mrb_value backtrace)
struct backtrace_location *bt;
mrb_int n, i;

if (mrb_nil_p(backtrace)) return mrb_ary_new_capa(mrb, 0);
if (mrb_array_p(backtrace)) return backtrace;
if (!mrb_string_p(backtrace)) {
broken:
Expand Down

0 comments on commit e969229

Please sign in to comment.