cards

alternative to Anki for the command-line
git clone https://github.com/jennydoe/cards.git
Log | Files | Refs | Feed | README

commit ee04eb376e4b067abc617d7fec77904cfbdbf1fb
parent ff36cdef19c6fd1e5b44e4499b5cebf0d42cdf5c
Author: Jenny Doe <tng@soykaf.me>
Date:   Tue,  9 Apr 2019 15:44:16 +0200

now verify that parse_csv() does not return NULL

Diffstat:
Mcards.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cards.c b/cards.c @@ -257,15 +257,21 @@ main(int argc, char *argv[]) char csv_line[MAX_CSV_SIZE]; + int l = 0; while (fgets(csv_line, MAX_CSV_SIZE, fp) != NULL) { + l++; + #define o(k,v, p, l) \ ht_insert(cards, k, v, p, l) char **items = parse_csv(csv_line); - if (!items[0] || !items[1] || !items[2]) - continue; + if (items == NULL || !items[0] || !items[1] || !items[2]) { + fprintf(stderr, "Couldn't parse line %d!\n", l); + fclose(fp); + goto end; + } wchar_t q[MAX_QA_SIZE], a[MAX_QA_SIZE]; swprintf(q, MAX_QA_SIZE, L"%hs", items[0]);