about summary refs log tree commit diff stats
path: root/src/tools/autocomplete.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-05-06 00:33:33 +0100
committerJames Booth <boothj5@gmail.com>2013-05-06 00:33:33 +0100
commit78ff58cf770b19b5f1eaf760d168799a8a6473e5 (patch)
tree620201ea5bc0db2a2f907d87e2c8f3976842fc7d /src/tools/autocomplete.c
parent3d8d5214bb93808252be6259980759ae3f3a2bbe (diff)
downloadprofani-tty-78ff58cf770b19b5f1eaf760d168799a8a6473e5.tar.gz
Fixed error when losing connection and segfaulting on notify_remind()
Diffstat (limited to 'src/tools/autocomplete.c')
-rw-r--r--src/tools/autocomplete.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c
index 72abcba4..adac86de 100644
--- a/src/tools/autocomplete.c
+++ b/src/tools/autocomplete.c
@@ -74,7 +74,13 @@ autocomplete_free(Autocomplete ac)
 gint
 autocomplete_length(Autocomplete ac)
 {
-    return g_slist_length(ac->items);
+    if (ac == NULL) {
+        return 0;
+    } else if (ac->items == NULL) {
+        return 0;
+    } else {
+        return g_slist_length(ac->items);
+    }
 }
 
 gboolean
/a> 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194