diff options
-rw-r--r-- | cras.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -179,6 +179,16 @@ store_input(TaskLst *list, FILE *fp) if (linebuf[strlen(linebuf) - 1] == '\n') linebuf[strlen(linebuf) - 1] = '\0'; + /* + * Ignoring blank lines so that the file doesn't get corrupted + * by one. We calculate strlen(linebuf) again because we + * *might* have chomped '\n' or not. Storing the size + * beforehand is not a viable optimization, as far as I can + * see. + */ + if (strlen(linebuf) == 0) + continue; + if (task_lst_add_task(list, TASK_TODO, linebuf) < 0) return -1; } |