summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-14 04:55:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-14 04:55:53 +0000
commita1a693e138392467ca74fb4ba5b071dd7675960e (patch)
tree7586388b543e40af025fa9e03a63b442eb254009 /array.c
parentd453b1a042a4483e74b17d66c7d88ec0c60b964a (diff)
signal delivered to main_thread
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/array.c b/array.c
index a53554b..6fdcf66 100644
--- a/array.c
+++ b/array.c
@@ -306,9 +306,6 @@ ary_subseq(ary, beg, len)
beg = RARRAY(ary)->len + beg;
if (beg < 0) beg = 0;
}
- if (beg >= RARRAY(ary)->len) {
- IndexError("out of range %d", beg);
- }
if (len < 0) {
IndexError("negative length %d", RARRAY(ary)->len);
}
@@ -318,6 +315,9 @@ ary_subseq(ary, beg, len)
if (beg + len > RARRAY(ary)->len) {
len = RARRAY(ary)->len - beg;
}
+ if (len < 0) {
+ len = 0;
+ }
ary2 = ary_new2(len);
MEMCPY(RARRAY(ary2)->ptr, RARRAY(ary)->ptr+beg, VALUE, len);