diff options
| author | Kouki Ooyatsu <[email protected]> | 2012-10-31 20:15:39 +0900 |
|---|---|---|
| committer | Kouki Ooyatsu <[email protected]> | 2012-10-31 20:20:36 +0900 |
| commit | 35699424a9e2d286fcbf3ac040f4e2a2b1027f0b (patch) | |
| tree | 8ede521113c33d54278cafc84a46ccb96c1511d3 | |
| parent | b720156c99eb974b13492873579239697ebcaf96 (diff) | |
| download | mruby-35699424a9e2d286fcbf3ac040f4e2a2b1027f0b.tar.gz mruby-35699424a9e2d286fcbf3ac040f4e2a2b1027f0b.zip | |
fix: broken variable reference, use 'next' statement
Because the tree is gone pop() even if it is empty.
| -rw-r--r-- | src/codegen.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen.c b/src/codegen.c index ebc9b32de..ca2269d85 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -1556,8 +1556,10 @@ codegen(codegen_scope *s, node *tree, int val) genop(s, MKOP_sBx(OP_JMP, s->loop->pc1 - s->pc)); } else { - codegen(s, tree, VAL); - pop(); + if (tree) { + codegen(s, tree, VAL); + pop(); + } genop_peep(s, MKOP_AB(OP_RETURN, cursp(), OP_R_NORMAL), NOVAL); } if (val) push(); |
