From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 1 Mar 2013 16:18:22 +0000 (+0100)
Subject: Stop hinting if no element is found.
X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=9b033a2ee7dc5cac8bdfdd0dc61c09194d7ff9ae;p=vimb.git

Stop hinting if no element is found.
---

diff --git a/src/hints.js b/src/hints.js
index 23e47be..2f777f2 100644
--- a/src/hints.js
+++ b/src/hints.js
@@ -121,11 +121,10 @@ VimpHints = function Hints(bg, bgf, fg, style) {
 
         _helper(topwin, 0, 0);
 
-        _focus(1);
-        if (hintCount == 1) {
-            /* just one hinted element - might as well follow it */
+        if (hintCount <= 1) {
             return this.fire(1);
         }
+        _focus(1);
     };
 
     /* set focus to next avaiable hint */
@@ -202,7 +201,7 @@ VimpHints = function Hints(bg, bgf, fg, style) {
         n = n ? n : curFocusNum;
         var result = "DONE:";
         var hint = _getHintByNumber(n);
-        if (typeof(hint.elem) == "undefined") {
+        if (!hint || typeof(hint.elem) == "undefined") {
             return result;
         }