Skip to content

Commit

Permalink
Handle case where project.el detects no project
Browse files Browse the repository at this point in the history
Previously if Projectile and find-file-in-project both failed, then
rg.el was assuming that (project-current) would return a valid
project. But if project.el can't find a project, then it'll return
nil, which will cause an error when passed to `project-roots'.
  • Loading branch information
raxod502 authored and dajva committed Dec 28, 2019
1 parent 2dc9c27 commit af1ae55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rg.el
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ If LITERAL is non nil prompt for literal string. DEFAULT is the default pattern
(when (and (require 'project nil t)
(fboundp 'project-current)
(fboundp 'project-roots))
(car (project-roots (project-current))))
(let ((project (project-current)))
(when project
(car (project-roots project)))))
(condition-case nil
(let* ((file (or file default-directory))
(backend (vc-responsible-backend file)))
Expand Down

0 comments on commit af1ae55

Please sign in to comment.