]> Sergey Matveev's repositories - nnn.git/commitdiff
Properly handle empty filters
authorsin <sin@2f30.org>
Fri, 20 Nov 2015 11:55:41 +0000 (11:55 +0000)
committersin <sin@2f30.org>
Fri, 20 Nov 2015 11:55:41 +0000 (11:55 +0000)
noice.c

diff --git a/noice.c b/noice.c
index c72417f9905dbfec773869ec7201e58c019d2453..fa712ffaf0f2c47740324457d5c2529b54277fd6 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -331,10 +331,11 @@ readln(void)
 
        echo();
        curs_set(TRUE);
+       memset(ln, 0, sizeof(ln));
        getnstr(ln, sizeof(ln) - 1);
        noecho();
        curs_set(FALSE);
-       return strdup(ln);
+       return strlen(ln) ? strdup(ln) : NULL;
 }
 
 /*