about summary refs log tree commit diff
path: root/users/tazjin/emacs/config/functions.el
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-07-08T22·12+0300
committerclbot <clbot@tvl.fyi>2023-07-08T22·16+0000
commitd73e8fb0412dbb82618dd4d03d420f631c6a3047 (patch)
tree5b6e484c9be0a1a45f2de9a0d93d658d02dba618 /users/tazjin/emacs/config/functions.el
parent20acf3ecfdb78495a3b31f1330d6cdd64e974683 (diff)
fix(tazjin/emacs): don't crash in find-cargo-project r/6400
Change-Id: I8a94892a527958946c975047204000eaf15395f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8946
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users/tazjin/emacs/config/functions.el')
-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)