From 9531b36b123889d78e9baba50e9fac3cef502714 Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 7 Sep 2019 03:51:45 +0200 Subject: Error when contact file is empty --- contactList.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contactList.c b/contactList.c index b40f3d4..7dadf41 100644 --- a/contactList.c +++ b/contactList.c @@ -187,8 +187,15 @@ int fillContactList(const char* filename) { } } } + fclose(file); +#ifdef DEBUG + if( nbContacts == 0 ) { + fprintf(stderr, "contact file empty"); + return 10; + } +#endif return 0; } -- cgit v1.2.3