]> git.deb.at Git - pkg/abook.git/commitdiff
Handle user aborting search (fixes Debian bug #386217).
authorCedric Duval <cedricduval@free.fr>
Wed, 6 Sep 2006 02:24:33 +0000 (02:24 +0000)
committerCedric Duval <cedricduval@free.fr>
Wed, 6 Sep 2006 02:24:33 +0000 (02:24 +0000)
ui.c

diff --git a/ui.c b/ui.c
index 0bfe4e3f6e03e3f795f6d3d9057edd69950ef363..1d5eb4327fa2fb49687b77fac3b50eb8d0d1bb14 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -567,9 +567,13 @@ ui_find(int next)
        } else {
                char *s;
                s = ui_readline("/", findstr, MAX_FIELD_LEN - 1, 0);
-               strncpy(findstr, s, MAX_FIELD_LEN);
-               free(s);
                refresh_screen();
+               if(s == NULL) {
+                       return; /* user cancelled (ctrl-G) */
+               } else {
+                       strncpy(findstr, s, MAX_FIELD_LEN);
+                       free(s);
+               }
        }
 
        if( (item = find_item(findstr, list_get_curitem() + !!next,