From 55b308fb2dbfd50fd825702e48c97cd264c899ad Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Fri, 23 Aug 2019 23:21:09 +0200 Subject: [PATCH] fix things with empty dorodata --- main.janet | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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)