diff options
author | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2016-11-15 00:17:35 +0900 |
---|---|---|
committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2016-11-15 00:17:35 +0900 |
commit | 3fd50d06a12da8b4a9b4201272ca1f08fabd415e (patch) | |
tree | bf588d0c591551c8da7f5fcb11fbee3892587a04 /Src/params.c | |
parent | 99acd1e7f48414e34aa08ec8246caa09088861df (diff) | |
download | zsh-3fd50d06a12da8b4a9b4201272ca1f08fabd415e.tar.gz zsh-3fd50d06a12da8b4a9b4201272ca1f08fabd415e.tar.xz zsh-3fd50d06a12da8b4a9b4201272ca1f08fabd415e.zip |
39937: fix a problem introduced by 39886.
$a[i,j] should become an empty array if i>j.
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/params.c b/Src/params.c index 6f587a30a..3c8658cc3 100644 --- a/Src/params.c +++ b/Src/params.c @@ -2292,10 +2292,11 @@ getarrvalue(Value v) v->end += arrlen(s) + 1; /* Null if 1) array too short, 2) index still negative */ - if (arrlen_lt(s, v->start) || v->start < 0) { + if (v->end <= v->start) { + s = arrdup_max(nular, 0); + } + else if (arrlen_lt(s, v->start) || v->start < 0) { s = arrdup_max(nular, 1); - } else if (v->end <= v->start) { - s = arrdup_max(nular, 0); } else { /* Copy to a point before the end of the source array: * arrdup_max will copy at most v->end - v->start elements, |