about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Builtins/_cd2
1 files changed, 1 insertions, 1 deletions
diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd
index 35940d1fe..d0ba62f2f 100644
--- a/Completion/Builtins/_cd
+++ b/Completion/Builtins/_cd
@@ -67,7 +67,7 @@ elif [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
   # variable names, but it hardly seems worth it.
   # Note we need a tilde because cdablevars also allows user home
   # directories, hence we also need nonomatch to suppress error messages.
-  if [[ -o cdablevars && ! -d ${tdir::=${PREFIX%%/*}} &&
+  if [[ -o cdablevars && -n "$PREFIX" && ! -d ${tdir::=${PREFIX%%/*}} &&
     -d ${~tdir2::="~$tdir"} ]]; then
       PREFIX="~$PREFIX"
       _path_files -/