summaryrefslogtreecommitdiffstats
path: root/cras.c
diff options
context:
space:
mode:
Diffstat (limited to 'cras.c')
-rw-r--r--cras.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cras.c b/cras.c
index e2b0deb..2f56d05 100644
--- a/cras.c
+++ b/cras.c
@@ -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;
}