summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-09-20 10:35:01 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-20 10:35:01 +0900
commitf85c50543b4ec93f327b9b064ea193493b046766 (patch)
tree52fde78d3cb9433ef27cab527553980b67cbc0b0 /mrbgems/mruby-compiler/core/codegen.c
parent938af8a8ff8f3031f2a6100dcba705ae5d43be0b (diff)
downloadmruby-f85c50543b4ec93f327b9b064ea193493b046766.tar.gz
mruby-f85c50543b4ec93f327b9b064ea193493b046766.zip
codegen.c (mrb_last_insn): no previous instruction on top.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 48543bd7e..380cd9317 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -467,6 +467,10 @@ mrb_prev_pc(codegen_scope *s, const mrb_code *pc)
static struct mrb_insn_data
mrb_last_insn(codegen_scope *s)
{
+ if (s->pc == 0) {
+ struct mrb_insn_data data = { OP_NOP, 0 };
+ return data;
+ }
return mrb_decode_insn(&s->iseq[s->lastpc]);
}