Permalink
Browse files

Null check for irep & initialize loc.lineno

  • Loading branch information...
jbreeden committed Mar 5, 2016
1 parent 4f4fa0a commit e02ff850fe6eb77ee73571cc163783c3df3b4788
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/backtrace.c
View
@@ -108,6 +108,8 @@ each_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, each_backtrace_func
for (i = ciidx; i >= 0; i--) {
struct backtrace_location_raw loc;
loc.lineno = -1;
mrb_callinfo *ci;
mrb_irep *irep;
mrb_code *pc;
@@ -128,8 +130,11 @@ each_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, each_backtrace_func
else {
pc = pc0;
}
loc.filename = mrb_debug_get_filename(irep, (uint32_t)(pc - irep->iseq));
loc.lineno = mrb_debug_get_line(irep, (uint32_t)(pc - irep->iseq));
if (irep) {
loc.filename = mrb_debug_get_filename(irep, (uint32_t)(pc - irep->iseq));
loc.lineno = mrb_debug_get_line(irep, (uint32_t)(pc - irep->iseq));
}
if (loc.lineno == -1) continue;

0 comments on commit e02ff85

Please sign in to comment.