diff --git a/main.janet b/main.janet index b25ee21..6f012f4 100644 --- a/main.janet +++ b/main.janet @@ -43,7 +43,8 @@ (defn lines->entries [lines] (var entries @[]) - (loop [line :in lines] + (loop [line :in lines + :when (> (length line) 0)] (let [[key content] (string/split ":" line) kwkey (keyword key)] (when (or (= "id" key) @@ -85,8 +86,11 @@ (readline)) (defn new-id [] - (inc (max ;(map (fn [e] (scan-number (e :id))) - (load-entries))))) + (inc (or (max ;(map (fn [e] + (scan-number + (get e :id "0"))) + (load-entries))) + 0))) (defn add [] (-> (load-entries)