mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
proc.c (closure_setup): fix NULL check logic
It used to check ci to be non NULL in line 37, but we silently assumed ci was not NULL in the `else` clause too. So instead of checking NULL, we add assertion. This incomplete check was found by clang-tidy.
This commit is contained in:
+2
-1
@@ -96,7 +96,8 @@ closure_setup(mrb_state *mrb, struct RProc *p)
|
||||
const struct RProc *up = p->upper;
|
||||
struct REnv *e = NULL;
|
||||
|
||||
if (ci && (e = mrb_vm_ci_env(ci)) != NULL) {
|
||||
mrb_assert(ci != NULL);
|
||||
if ((e = mrb_vm_ci_env(ci)) != NULL) {
|
||||
/* do nothing, because e is assigned already */
|
||||
}
|
||||
else if (up) {
|
||||
|
||||
Reference in New Issue
Block a user