diff options
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 43c2b08..5957951 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -9995,10 +9995,8 @@ GetSrcInfoForPc( int bestSrcLength = -1; /* Initialized to avoid compiler warning. */ int bestCmdIdx = -1; - if ((pcOffset < 0) || (pcOffset >= codePtr->numCodeBytes)) { - if (pcBeg != NULL) *pcBeg = NULL; - return NULL; - } + /* The pc must point within the bytecode */ + assert ((pcOffset >= 0) && (pcOffset < codePtr->numCodeBytes)); /* * Decode the code and source offset and length for each command. The @@ -10083,10 +10081,6 @@ GetSrcInfoForPc( *pcBeg = prev; } - if (bestDist == INT_MAX) { - return NULL; - } - if (lengthPtr != NULL) { *lengthPtr = bestSrcLength; } @@ -10095,6 +10089,10 @@ GetSrcInfoForPc( *cmdIdxPtr = bestCmdIdx; } + if (bestDist == INT_MAX) { + return NULL; + } + return (codePtr->source + bestSrcOffset); } |