39937: fix a problem introduced by 39886.

$a[i,j] should become an empty array if i>j.
This commit is contained in:
Jun-ichi Takimoto 2016-11-15 00:17:35 +09:00
parent 99acd1e7f4
commit 3fd50d06a1
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2016-11-15 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 39937: Src/params.c: fix a problem introduced by 39886.
$a[i,j] should become an empty array if i>j.
2016-11-14 Peter Stephenson <p.stephenson@samsung.com>
* 39906: Src/utils.c: More optimisation of multibyte handling

View file

@ -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,