From d73e8fb0412dbb82618dd4d03d420f631c6a3047 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 9 Jul 2023 01:12:26 +0300 Subject: [PATCH] fix(tazjin/emacs): don't crash in find-cargo-project Change-Id: I8a94892a527958946c975047204000eaf15395f2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8946 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: tazjin --- users/tazjin/emacs/config/functions.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 23cb47d02..39334c95a 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)