summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/array.c b/array.c
index 4eaf0c7ddc..30caf7b5da 100644
--- a/array.c
+++ b/array.c
@@ -1888,6 +1888,7 @@ rb_ary_slice_bang(int argc, VALUE *argv, VALUE ary)
delete_pos_len:
if (pos < 0) {
pos = RARRAY_LEN(ary) + pos;
+ if (pos < 0) return Qnil;
}
arg2 = rb_ary_subseq(ary, pos, len);
rb_ary_splice(ary, pos, len, Qundef); /* Qnil/rb_ary_new2(0) */