summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-03-07 12:08:40 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-03-07 12:08:40 (GMT)
commit9fb94718075b45530e0a14cc39ddbb9185d9bf48 (patch)
treec3fdb2190b143ef4c832e79ebd68a39c1153f1b9 /generic/tclExecute.c
parent720c8de45208caf2ba463bac1ad09ea5766fd34c (diff)
parent8c2cbf32116e7f5f5952e0d063a90125fcd4147d (diff)
downloadtcl-9fb94718075b45530e0a14cc39ddbb9185d9bf48.zip
tcl-9fb94718075b45530e0a14cc39ddbb9185d9bf48.tar.gz
tcl-9fb94718075b45530e0a14cc39ddbb9185d9bf48.tar.bz2
Incorporate sebres work on the same ticket. Good stuff!
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 93ed50b..d345899 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5091,7 +5091,7 @@ TEBCresume(
/*
* Select the list item based on the index. Negative operand means
- * end-based indexing.
+ * end-based indexing (-2, ...), and -1 means out of range.
*/
if (opnd < -1) {
@@ -5649,7 +5649,9 @@ TEBCresume(
* Adjust indices for end-based indexing.
*/
- if (fromIdx < -1) {
+ if (fromIdx == -1) {
+ fromIdx = 0;
+ } else if (fromIdx < -1) {
fromIdx += 1 + length;
if (fromIdx < 0) {
fromIdx = 0;