diff options
author | griffin <briang42@easystreet.net> | 2023-08-08 17:10:20 (GMT) |
---|---|---|
committer | griffin <briang42@easystreet.net> | 2023-08-08 17:10:20 (GMT) |
commit | 0d106bd729c6d46d0806fd57f2fc799aef68a2aa (patch) | |
tree | 84feb3f1c2360975d942a63fa2bdd2a63afa04ce /generic/tclArithSeries.c | |
parent | 4eef7b0ff03eacf3a688630bc515eea1f4340ce4 (diff) | |
download | tcl-0d106bd729c6d46d0806fd57f2fc799aef68a2aa.zip tcl-0d106bd729c6d46d0806fd57f2fc799aef68a2aa.tar.gz tcl-0d106bd729c6d46d0806fd57f2fc799aef68a2aa.tar.bz2 |
Fix bug [30e4e9102f] - Abstract List ListIndex should return NULL when index out of range.
Diffstat (limited to 'generic/tclArithSeries.c')
-rwxr-xr-x | generic/tclArithSeries.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index b6ea45b..415c85a 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -610,7 +610,7 @@ TclArithSeriesObjIndex( ArithSeries *arithSeriesRepPtr = ArithSeriesGetInternalRep(arithSeriesObj); if (index < 0 || arithSeriesRepPtr->len <= index) { - *elemObj = Tcl_NewObj(); + *elemObj = NULL; } else { /* List[i] = Start + (Step * index) */ if (arithSeriesRepPtr->isDouble) { @@ -1183,8 +1183,8 @@ ArithSeriesInOperation( Tcl_Obj *elemObj; index = (y - intRepPtr->start) / intRepPtr->step; TclArithSeriesObjIndex(interp, arithSeriesObjPtr, index, &elemObj); - char *vstr = Tcl_GetStringFromObj(valueObj, &vlen); - char *estr = Tcl_GetStringFromObj(elemObj, &elen); + char const *vstr = Tcl_GetStringFromObj(valueObj, &vlen); + char const *estr = elemObj ? Tcl_GetStringFromObj(elemObj, &elen) : ""; if (boolResult) { *boolResult = (elen == vlen) ? (memcmp(estr, vstr, elen) == 0) : 0; } |