Fix tab completion when you just do a plain tab without entering anything, and also...
[asterisk/asterisk.git] / pbx.c
diff --git a/pbx.c b/pbx.c
index 1a5f6f4..d1e2028 100644 (file)
--- a/pbx.c
+++ b/pbx.c
@@ -2864,8 +2864,10 @@ static char *complete_show_application(const char *line, const char *word, int p
        /* return the n-th [partial] matching entry */
        AST_LIST_LOCK(&apps);
        AST_LIST_TRAVERSE(&apps, a, list) {
-               if (!strncasecmp(word, a->name, wordlen) && ++which > state)
+               if (!strncasecmp(word, a->name, wordlen) && ++which > state) {
                        ret = strdup(a->name);
+                       break;
+               }
        }
        AST_LIST_UNLOCK(&apps);