From 8463e3dec0299c49acf3ef654908ef64bc8cd6de Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 26 Sep 2012 19:52:42 +0200 Subject: [PATCH] Don't fail when generating first id --- undone/main.scm | 8 +++++--- 1 file 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."