Fixing segfault in case of empty input
authorphillbush <phillbush@cock.li>
Sat, 30 May 2020 02:55:37 +0000 (23:55 -0300)
committerphillbush <phillbush@cock.li>
Sat, 30 May 2020 02:55:37 +0000 (23:55 -0300)
xmenu.c

diff --git a/xmenu.c b/xmenu.c
index 5fefae8..31984fb 100644 (file)
--- a/xmenu.c
+++ b/xmenu.c
@@ -379,6 +379,8 @@ parsestdin(void)
        char *label, *output;
        unsigned level = 0;
 
        char *label, *output;
        unsigned level = 0;
 
+       rootmenu = NULL;
+
        while (fgets(buf, BUFSIZ, stdin) != NULL) {
                /* get the indentation level */
                level = strspn(buf, "\t");
        while (fgets(buf, BUFSIZ, stdin) != NULL) {
                /* get the indentation level */
                level = strspn(buf, "\t");