summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclIndexObj.c8
-rw-r--r--generic/tclStringObj.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 248dbe1..067f86b 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -192,7 +192,7 @@ Tcl_GetIndexFromObjStruct(
size_t offset, /* The number of bytes between entries */
const char *msg, /* Identifying word to use in error
* messages. */
- int flags, /* 0 or TCL_EXACT */
+ int flags, /* 0, TCL_EXACT or TCL_INDEX_TEMP_TABLE */
int *indexPtr) /* Place to store resulting integer index. */
{
int index, idx, numAbbrev;
@@ -211,7 +211,7 @@ Tcl_GetIndexFromObjStruct(
* See if there is a valid cached result from a previous lookup.
*/
- if (!(flags & TCL_INDEX_TEMP_TABLE)) {
+ if (objPtr && !(flags & TCL_INDEX_TEMP_TABLE)) {
irPtr = TclFetchInternalRep(objPtr, &indexType);
if (irPtr) {
indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;
@@ -227,7 +227,7 @@ Tcl_GetIndexFromObjStruct(
* abbreviations unless TCL_EXACT is set in flags.
*/
- key = TclGetString(objPtr);
+ key = objPtr ? TclGetString(objPtr) : "";
index = -1;
numAbbrev = 0;
@@ -275,7 +275,7 @@ Tcl_GetIndexFromObjStruct(
* operation.
*/
- if (!(flags & TCL_INDEX_TEMP_TABLE)) {
+ if (objPtr && !(flags & TCL_INDEX_TEMP_TABLE)) {
irPtr = TclFetchInternalRep(objPtr, &indexType);
if (irPtr) {
indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index cde9a1d..789e580 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1614,8 +1614,8 @@ AppendUtfToUtfRep(
* the reallocs below.
*/
- if (bytes && bytes >= objPtr->bytes
- && bytes <= objPtr->bytes + objPtr->length) {
+ if (bytes && objPtr->bytes && (bytes >= objPtr->bytes)
+ && (bytes <= objPtr->bytes + objPtr->length)) {
offset = bytes - objPtr->bytes;
}