From 47eed29ef5c9ee2d6aa4a27e07d8e94737b4bac1 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Fri, 5 Jul 2019 20:07:31 -0400 Subject: hn: Update athings:hash. * hn (athings:hash): If read-json returns #eof return empty hash. --- hn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hn b/hn index 0c424b7..f410878 100755 --- a/hn +++ b/hn @@ -76,7 +76,10 @@ (define (athings:hash f) (cond ((file-exists? f) - (call-with-input-file f (λ (in) (read-json in)))) + (call-with-input-file f + (λ (in) + (let ((j (read-json in))) + (if (eof-object? j) (make-immutable-hash) j))))) (else (make-immutable-hash)))) (define (athings:list) -- cgit v1.2.3