File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -719,8 +719,10 @@ proc formatErrStackTrace {errmsg loc {cmdlist {}}} {
719719 set headstr " \n while executing\n "
720720 set splitstr " \n invoked from within\n "
721721 set splitstrlen [string length $splitstr ]
722- set aftheadidx [expr {[string length $headstr ] + [string first $headstr \
723- $errmsg ]}]
722+ set aftheadidx [string first $headstr $errmsg ]
723+ if {$aftheadidx != -1} {
724+ incr aftheadidx [string length $headstr ]
725+ }
724726
725727 # get name of invalid command name to maintain it in error stack trace
726728 if {[string equal -length 22 {invalid command name " } $errmsg ]} {
@@ -744,7 +746,7 @@ proc formatErrStackTrace {errmsg loc {cmdlist {}}} {
744746
745747 # filter out modulecmd internal references at beginning of stack
746748 set internals 1
747- while {$internals } {
749+ while {$internals && $aftheadidx != -1 } {
748750 # fetch erroneous command and its caller
749751 set stackelt [string range $errmsg $aftheadidx [string first\
750752 $splitstr $errmsg $aftheadidx ]]
You can’t perform that action at this time.
0 commit comments