zshrc: check for DIRSTACK{SIZE,FILE} in chpwd()
authorMichael Prokop <mika@grml.org>
Mon, 3 Feb 2014 13:49:34 +0000 (14:49 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 3 Feb 2014 13:50:20 +0000 (14:50 +0100)
If the environment variables are unset chpwd emmits an
error message, so check before using.

Thanks: Frank Terbeck <ft@grml.org> for review

etc/zsh/zshrc

index bd8ab85..1af7ed7 100644 (file)
@@ -1556,6 +1556,7 @@ if [[ -f ${DIRSTACKFILE} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
 fi
 
 chpwd() {
 fi
 
 chpwd() {
+    if (( $DIRSTACKSIZE <= 0 )) || [[ -z $DIRSTACKFILE ]]; then return; fi
     local -ax my_stack
     my_stack=( ${PWD} ${dirstack} )
     if is42 ; then
     local -ax my_stack
     my_stack=( ${PWD} ${dirstack} )
     if is42 ; then