branch: master
commit af5d2c16d94368c2e424027a725eb28cdf8e49ea
Author: Wilfred Hughes <[email protected]>
Commit: Wilfred Hughes <[email protected]>

    Don't crash if default-directory is nil.
    
    I think this is a pretty rare occurrence (for some reason I had a
    `*Backtrace*` buffer with `default-directory` set to nil). However,
    `ivy-switch-buffer` would break in this situation.
---
 ivy.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 96fe05c..c09ed4a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2731,8 +2731,9 @@ When VIRTUAL is non-nil, add virtual buffers."
     (mapcar
      (lambda (x)
        (if (with-current-buffer x
-             (file-remote-p
-              (abbreviate-file-name default-directory)))
+             (and default-directory
+                  (file-remote-p
+                   (abbreviate-file-name default-directory))))
            (propertize x 'face 'ivy-remote)
          (let ((face (with-current-buffer x
                        (cdr (assoc major-mode

Reply via email to