summaryrefslogtreecommitdiffstats
path: root/library/auto.tcl
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-01-25 17:04:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-01-25 17:04:20 (GMT)
commit3c6ddb9aced9de4312cc2a982bf5715af646eddb (patch)
tree55d7a724ec1f2b6f934aa5ffc6c1c2d2de5a736e /library/auto.tcl
parent2d7b99e0ac484196f8de1cd5a31123baa638d6e7 (diff)
downloadtcl-3c6ddb9aced9de4312cc2a982bf5715af646eddb.zip
tcl-3c6ddb9aced9de4312cc2a982bf5715af646eddb.tar.gz
tcl-3c6ddb9aced9de4312cc2a982bf5715af646eddb.tar.bz2
Added safety checks
Diffstat (limited to 'library/auto.tcl')
-rw-r--r--library/auto.tcl20
1 files changed, 13 insertions, 7 deletions
diff --git a/library/auto.tcl b/library/auto.tcl
index e8aa61a..f77b866 100644
--- a/library/auto.tcl
+++ b/library/auto.tcl
@@ -3,7 +3,7 @@
# utility procs formerly in init.tcl dealing with auto execution
# of commands and can be auto loaded themselves.
#
-# RCS: @(#) $Id: auto.tcl,v 1.22 2005/01/25 16:39:56 dgp Exp $
+# RCS: @(#) $Id: auto.tcl,v 1.23 2005/01/25 17:04:20 dgp Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
@@ -22,14 +22,20 @@
# None.
proc auto_reset {} {
- foreach cmdName [array names ::auto_index] {
- set fqcn [namespace which $cmdName]
- if {$fqcn eq ""} {continue}
- rename $fqcn {}
+ if {[array exists ::auto_index]} {
+ foreach cmdName [array names ::auto_index] {
+ set fqcn [namespace which $cmdName]
+ if {$fqcn eq ""} {continue}
+ rename $fqcn {}
+ }
}
unset -nocomplain ::auto_execs ::auto_index ::tcl::auto_oldpath
- if {[info library] ni $::auto_path} {
- lappend ::auto_path [info library]
+ if {[catch {llength $::auto_path}]} {
+ set ::auto_path [list [info library]]
+ } else {
+ if {[info library] ni $::auto_path} {
+ lappend ::auto_path [info library]
+ }
}
}