summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 4948654e93..218afcfcd2 100644
--- a/compile.c
+++ b/compile.c
@@ -4855,6 +4855,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_NTH_REF:{
if (!poped) {
+ if (!node->nd_nth) {
+ ADD_INSN(ret, line, putnil);
+ break;
+ }
ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(node->nd_nth << 1));
}