Skip to content

Commit b3d12a5

Browse files
author
jan.nijtmans
committed
Merge 8.6
2 parents 63b4271 + f60e164 commit b3d12a5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

generic/tclIndexObj.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct {
7373
#define NEXT_ENTRY(table, offset) \
7474
(&(STRING_AT(table, offset)))
7575
#define EXPAND_OF(indexRep) \
76-
STRING_AT((indexRep)->tablePtr, (indexRep)->offset*(indexRep)->index)
76+
(((indexRep)->index >= 0) ? STRING_AT((indexRep)->tablePtr, (indexRep)->offset*(indexRep)->index) : "")
7777

7878
/*
7979
*----------------------------------------------------------------------
@@ -284,7 +284,9 @@ Tcl_GetIndexFromObjStruct(
284284
irPtr = TclFetchInternalRep(objPtr, &indexType);
285285
if (irPtr) {
286286
indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;
287-
if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) {
287+
if ((indexRep->tablePtr == tablePtr)
288+
&& (indexRep->offset == offset)
289+
&& (indexRep->index >= 0)) {
288290
*indexPtr = indexRep->index;
289291
return TCL_OK;
290292
}
@@ -344,7 +346,7 @@ Tcl_GetIndexFromObjStruct(
344346
* operation.
345347
*/
346348

347-
if (objPtr && !(flags & TCL_INDEX_TEMP_TABLE)) {
349+
if (objPtr && (index >= 0) && !(flags & TCL_INDEX_TEMP_TABLE)) {
348350
irPtr = TclFetchInternalRep(objPtr, &indexType);
349351
if (irPtr) {
350352
indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;

0 commit comments

Comments
 (0)