summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--undone/main.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/undone/main.scm b/undone/main.scm
index 322a73e..b9ae986 100644
--- a/undone/main.scm
+++ b/undone/main.scm
@@ -128,9 +128,11 @@
(define (next-id)
"Look through all known todo items and get the next id."
- (1+ (apply max (map (lambda (elm)
- (get-field-value id elm 0))
- todo-list))))
+ (if (> (length todo-list) 0)
+ (1+ (apply max (map (lambda (elm)
+ (get-field-value id elm 0))
+ todo-list)))
+ 1))
(define (add args)
"Add item to the list."