summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-12-09 14:39:19 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-12-09 14:39:19 (GMT)
commit935e1e7bff4e2328bdf256ef524c4a6a3aa9947e (patch)
treeda3986461468c87bac28425373ea0a11e510ddb2 /generic
parent268ee946f3eb31ba016fd1d3275e202b7617dbe1 (diff)
downloadtcl-935e1e7bff4e2328bdf256ef524c4a6a3aa9947e.zip
tcl-935e1e7bff4e2328bdf256ef524c4a6a3aa9947e.tar.gz
tcl-935e1e7bff4e2328bdf256ef524c4a6a3aa9947e.tar.bz2
Fix [Bug 1374778]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdIL.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 7a232a6..a867272 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.8 2005/11/29 10:32:31 dkf Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.9 2005/12/09 14:39:25 dkf Exp $
*/
#include "tclInt.h"
@@ -3066,8 +3066,19 @@ Tcl_LsearchObjCmd(clientData, interp, objc, objv)
if (result != TCL_OK) {
return result;
}
+
+ /*
+ * If the search started past the end of the list, we just return a
+ * "did not match anything at all" result straight away. [Bug 1374778]
+ */
+
if (offset > listc-1) {
- offset = listc-1;
+ if (allMatches || inlineReturn) {
+ Tcl_ResetResult(interp);
+ } else {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(-1));
+ }
+ return TCL_OK;
}
if (offset < 0) {
offset = 0;