summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-17 17:26:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-17 17:26:37 (GMT)
commitc3bcd951b8dd8bf57202915b9d914bcddc73b9bb (patch)
tree9cab1970a2554690061d6b0cb437de08f09ffffa /generic/tclCmdMZ.c
parent01a48e2369782044a30d922c5f8ed52262ef4fcd (diff)
downloadtcl-c3bcd951b8dd8bf57202915b9d914bcddc73b9bb.zip
tcl-c3bcd951b8dd8bf57202915b9d914bcddc73b9bb.tar.gz
tcl-c3bcd951b8dd8bf57202915b9d914bcddc73b9bb.tar.bz2
Possible fix for [e9a2715d91]: Tcl 8.6.11: Incompatible Tcl_GetRange()
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 5422b7f..bf75d44 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -395,9 +395,13 @@ Tcl_RegexpObjCmd(
newPtr = Tcl_NewListObj(2, objs);
} else {
if (i <= info.nsubs) {
- newPtr = Tcl_GetRange(objPtr,
- offset + info.matches[i].start,
- offset + info.matches[i].end - 1);
+ if (info.matches[i].end <= 0) {
+ TclNewObj(newPtr);
+ } else {
+ newPtr = Tcl_GetRange(objPtr,
+ offset + info.matches[i].start,
+ offset + info.matches[i].end - 1);
+ }
} else {
TclNewObj(newPtr);
}
@@ -2183,7 +2187,9 @@ StringRangeCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
+ if (last >= 0) {
+ Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
+ }
return TCL_OK;
}