fix: Do not crash on e.g. dmenu < /dev/null
authorS. Gilles <sgilles@math.umd.edu>
Tue, 28 Jun 2016 05:11:50 +0000 (01:11 -0400)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 28 Jun 2016 15:51:28 +0000 (17:51 +0200)
dmenu.c

diff --git a/dmenu.c b/dmenu.c
index 0e7b70b..e926eca 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -480,7 +480,7 @@ readstdin(void)
        }
        if (items)
                items[i].text = NULL;
-       inputw = TEXTW(items[imax].text);
+       inputw = items ? TEXTW(items[imax].text) : 0;
        lines = MIN(lines, i);
 }