branch: externals/ellama
commit 20781d80c9bf5ac18fab048b80ff975fa5c3f2c5
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Guard against nil project root tool result
Wrapped the `ellama-tools-project-root-tool` result in an `and` expression
to
prevent errors when the tool returns nil, ensuring file-name-directory and
expand-file-name only execute when a valid project root path is provided.
Fixes #383
---
ellama.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ellama.el b/ellama.el
index a3d50f0141..c61ba2c409 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1217,8 +1217,9 @@ Otherwire return current active session."
"Search for AGENTS.md file from current directory up to project root.
Returns the full path to AGENTS.md if found, or nil if not found."
(let* ((current-dir (file-name-directory (expand-file-name
default-directory)))
- (project-root (or (file-name-directory (expand-file-name
-
(ellama-tools-project-root-tool)))
+ (project-root (or (and (ellama-tools-project-root-tool)
+ (file-name-directory (expand-file-name
+
(ellama-tools-project-root-tool))))
current-dir))
found-path)
;; Walk up from current directory to project root