branch: externals/ivy-hydra
commit 40b4705280d989b8f366c06aa492618fe8fb6655
Author: Oleh Krehel <ohwoeo...@gmail.com>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    ivy.el (ivy--dynamic-collection-cands): Handle the case of coll 0
    
    The collection may return 0, with the intention to use 
`ivy-update-candidates'.
    0 is not a list, so we need to check it.
    
    Fixes #2472
---
 ivy.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index bf8f8e2..9a8210b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3346,8 +3346,10 @@ Should be run via minibuffer `post-command-hook'."
     t))
 
 (defun ivy--dynamic-collection-cands (input)
-  (mapcar (lambda (x) (if (consp x) (car x) x))
-          (funcall (ivy-state-collection ivy-last) input)))
+  (let ((coll (funcall (ivy-state-collection ivy-last) input)))
+    (if (listp coll)
+        (mapcar (lambda (x) (if (consp x) (car x) x)) coll)
+      coll)))
 
 (defun ivy--update-minibuffer ()
   (prog1

Reply via email to