Browse Source

dircycle: fix error on insert-cycledleft if dirstack is empty

Marc Cornellà 7 years ago
parent
commit
6685aac42c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      plugins/dircycle/dircycle.plugin.zsh

+ 2 - 0
plugins/dircycle/dircycle.plugin.zsh

@@ -9,6 +9,8 @@
 #  pushd -N: start counting from right of `dirs' output
 #  pushd -N: start counting from right of `dirs' output
 
 
 switch-to-dir () {
 switch-to-dir () {
+	[[ ${#dirstack} -eq 0 ]] && return
+
 	while ! builtin pushd -q $1 &>/dev/null; do
 	while ! builtin pushd -q $1 &>/dev/null; do
 		# We found a missing directory: pop it out of the dir stack
 		# We found a missing directory: pop it out of the dir stack
 		builtin popd -q $1
 		builtin popd -q $1