Harness dispatch_menu_result against stupid input
This commit is contained in:
parent
38c788c367
commit
c80e3e9a42
18
src/menu.c
18
src/menu.c
@ -176,19 +176,25 @@ void invoke_action(const char *action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Dispatch whatever has been returned
|
* Dispatch whatever has been returned by dmenu.
|
||||||
* by the menu.
|
* If the given result of dmenu is empty or NULL, nothing will be done.
|
||||||
|
*
|
||||||
|
* @param input The result from dmenu.
|
||||||
*/
|
*/
|
||||||
void dispatch_menu_result(const char *input)
|
void dispatch_menu_result(const char *input)
|
||||||
{
|
{
|
||||||
|
if (!input)
|
||||||
|
return;
|
||||||
|
|
||||||
char *in = g_strdup(input);
|
char *in = g_strdup(input);
|
||||||
g_strstrip(in);
|
g_strstrip(in);
|
||||||
if (in[0] == '#') {
|
|
||||||
|
if (in[0] == '#')
|
||||||
invoke_action(in + 1);
|
invoke_action(in + 1);
|
||||||
} else {
|
else if (in[0] != '\0')
|
||||||
open_browser(in);
|
open_browser(in);
|
||||||
}
|
|
||||||
g_free(in);
|
g_free(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user