From 3c6ddb9aced9de4312cc2a982bf5715af646eddb Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Jan 2005 17:04:20 +0000 Subject: Added safety checks --- library/auto.tcl | 20 +++++++++++++------- 1 file 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] + } } } -- cgit v0.12