From 109da08d8af01c26a824212e07a06c71a574917e Mon Sep 17 00:00:00 2001 From: dearblue Date: Sat, 25 Jun 2022 11:41:55 +0900 Subject: [PATCH] Fixes `mrb_vm_ci_target_class_set()` If `ci->u.target_class` was `NULL`, the value of the argument was always ignored. This problem is caused by #5272. ref. #5725 --- include/mruby/proc.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/mruby/proc.h b/include/mruby/proc.h index 9d197f48a..bd1b5a705 100644 --- a/include/mruby/proc.h +++ b/include/mruby/proc.h @@ -157,13 +157,11 @@ static inline void mrb_vm_ci_target_class_set(mrb_callinfo *ci, struct RClass *tc) { struct REnv *e = ci->u.env; - if (e) { - if (e->tt == MRB_TT_ENV) { - e->c = tc; - } - else { - ci->u.target_class = tc; - } + if (e && e->tt == MRB_TT_ENV) { + e->c = tc; + } + else { + ci->u.target_class = tc; } }