about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/tazjin/emacs/config/functions.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el
index 23cb47d02a3b..39334c95a509 100644
--- a/users/tazjin/emacs/config/functions.el
+++ b/users/tazjin/emacs/config/functions.el
@@ -301,10 +301,11 @@ the GPG agent correctly."
 (defun find-cargo-project (dir)
   "Attempt to find the current project in `project-find-functions'
 by looking for a `Cargo.toml' file."
-  (unless (equal "/" dir)
-    (if (f-exists-p (f-join dir "Cargo.toml"))
-        (cons 'transient dir)
-      (find-cargo-project (f-parent dir)))))
+  (when dir
+    (unless (equal "/" dir)
+      (if (f-exists-p (f-join dir "Cargo.toml"))
+          (cons 'transient dir)
+        (find-cargo-project (f-parent dir))))))
 
 (add-to-list 'project-find-functions #'find-cargo-project)