diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-08-13 10:02:01 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-08-13 10:02:01 +0900 |
| commit | cbdc4f2c5c290173b17fd7b4cf23244f1acc39e1 (patch) | |
| tree | a3f8e8329bfd235f97fc4245ca50881cdedc517e /mrbgems/mruby-compiler/core/codegen.c | |
| parent | 013365498d7d46ab71d210f5f83ab8ce94c1a21b (diff) | |
| download | mruby-cbdc4f2c5c290173b17fd7b4cf23244f1acc39e1.tar.gz mruby-cbdc4f2c5c290173b17fd7b4cf23244f1acc39e1.zip | |
codegen.c: `mrb_prev_pc` can return `NULL` at the top of `iseq`.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 4b55ca6ff..1bac4e061 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -323,12 +323,13 @@ struct mrb_insn_data mrb_decode_insn(const mrb_code *pc) { struct mrb_insn_data data = { 0 }; - data.addr = pc; + if (pc == 0) return data; mrb_code insn = READ_B(); uint16_t a = 0; uint16_t b = 0; uint16_t c = 0; + data.addr = pc; switch (insn) { #define FETCH_Z() /* empty */ #define OPCODE(i,x) case OP_ ## i: FETCH_ ## x (); break; |
