summary refs log tree commit diff
path: root/kbfunc.c
diff options
context:
space:
mode:
authorokan <okan>2009-09-05 16:06:15 +0000
committerokan <okan>2009-09-05 16:06:15 +0000
commit4af6a60d849f7023a9b3622cb57731898a7f72f3 (patch)
treea1d4f7944ee197192a1e60ac7c1e82bbe079e490 /kbfunc.c
parent38ad2e1d9c4414d8af4821a81c43aa98255198d8 (diff)
downloadcwm-4af6a60d849f7023a9b3622cb57731898a7f72f3.tar.gz
cwm-4af6a60d849f7023a9b3622cb57731898a7f72f3.tar.xz
cwm-4af6a60d849f7023a9b3622cb57731898a7f72f3.zip
re-introduce the intention of the change from rev 1.4 in menu.c here
instead, by moving the check for '\0' to only the places that it
matters.  hint and 50% of the diff from oga@, prodded by todd@

ok oga@
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kbfunc.c b/kbfunc.c
index 1c39c71..bae7e2f 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -285,6 +285,8 @@ kbfunc_exec(struct client_ctx *scratch, union arg *arg)
 
 	if ((mi = menu_filter(&menuq, label, NULL, 1,
 	    search_match_exec, NULL)) != NULL) {
+		if (mi->text[0] == '\0')
+			goto out;
 		switch (cmd) {
 			case CWM_EXEC_PROGRAM:
 				u_spawn(mi->text);
@@ -298,7 +300,7 @@ kbfunc_exec(struct client_ctx *scratch, union arg *arg)
 				break;
 		}
 	}
-
+out:
 	if (mi != NULL && mi->dummy)
 		xfree(mi);
 	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
@@ -360,12 +362,14 @@ kbfunc_ssh(struct client_ctx *scratch, union arg *arg)
 
 	if ((mi = menu_filter(&menuq, "ssh", NULL, 1,
 	    search_match_exec, NULL)) != NULL) {
+		if (mi->text[0] == '\0')
+			goto out;
 		l = snprintf(cmd, sizeof(cmd), "%s -e ssh %s", Conf.termpath,
 		    mi->text);
 		if (l != -1 && l < sizeof(cmd))
 			u_spawn(cmd);
 	}
-
+out:
 	if (mi != NULL && mi->dummy)
 		xfree(mi);
 	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {