aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2019-09-07 03:51:45 +0200
committerache <ache@ache.one>2019-09-07 03:51:45 +0200
commit9531b36b123889d78e9baba50e9fac3cef502714 (patch)
tree9607b717bbaae968cda7fd1a3b53fb9076945a56
parentFix return error (diff)
Error when contact file is empty
-rw-r--r--contactList.c7
1 files changed, 7 insertions, 0 deletions
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;
}