diff --git a/src/debug.c b/src/debug.c index d59d8e9c4..c17c09580 100644 --- a/src/debug.c +++ b/src/debug.c @@ -159,11 +159,7 @@ mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc) MRB_API mrb_bool mrb_debug_get_position(mrb_state *mrb, const mrb_irep *irep, uint32_t pc, int32_t *lp, const char **fp) { - if (irep && pc < irep->ilen) { - if (!irep->debug_info) { - *lp = -1; *fp = NULL; - return FALSE; - } + if (irep && pc < irep->ilen && irep->debug_info) { mrb_irep_debug_info_file *f = get_file(irep->debug_info, pc); *lp = debug_get_line(mrb, f, pc); if (*lp > 0) { @@ -171,6 +167,7 @@ mrb_debug_get_position(mrb_state *mrb, const mrb_irep *irep, uint32_t pc, int32_ if (*fp) return TRUE; } } + *lp = -1; *fp = NULL; return FALSE; }