branch: master
commit dabd1f82c8960a038b905213a0561536d599ecac
Author: Oleh Krehel <ohwoeo...@gmail.com>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    ivy.el (ivy-avy): Make "C-g" cancel gracefully
    
    Fixes abo-abo/avy#140
---
 ivy.el |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index 37648bb..d082c8e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1080,9 +1080,10 @@ On error (read-only), call `ivy-on-del-error-function'."
             (avy--process
              (nreverse candidates)
              (avy--style-fn avy-style)))))
-    (ivy-set-index (- (line-number-at-pos candidate) 2))
-    (ivy--exhibit)
-    (ivy-done)))
+    (when (numberp candidate)
+      (ivy-set-index (- (line-number-at-pos candidate) 2))
+      (ivy--exhibit)
+      (ivy-done))))
 
 (defun ivy-sort-file-function-default (x y)
   "Compare two files X and Y.

Reply via email to