From 31c99eb99b52d7469bbe3f46863fcfe1bff36cfe Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 6 Apr 2023 15:47:24 +0900 Subject: [PATCH] debug.c (mrb_debug_get_position): do not keep lp and fp uninitialized --- src/debug.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; }