Fix minor bugs

This commit is contained in:
2026-01-31 10:54:03 +00:00
parent f93afc0d14
commit 410222b82a
2 changed files with 6 additions and 16 deletions

View File

@@ -70,7 +70,8 @@ void ruby_start() {
}
mrb_value mod_val = mrb_obj_value(C_module);
mrb_value block = mrb_funcall(mrb, mod_val, "b_startup", 0);
mrb_funcall(mrb, block, "call", 0);
if (!mrb_nil_p(block))
mrb_funcall(mrb, block, "call", 0);
}
inline static std::vector<BarLight>
@@ -165,7 +166,8 @@ void ruby_shutdown() {
return;
mrb_value mod_val = mrb_obj_value(C_module);
mrb_value block = mrb_funcall(mrb, mod_val, "b_shutdown", 0);
mrb_funcall(mrb, block, "call", 0);
if (!mrb_nil_p(block))
mrb_funcall(mrb, block, "call", 0);
mrb_close(mrb);
mrb = nullptr;
C_module = nullptr;