diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-19 12:40:58 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-19 12:40:58 +0100 |
commit | b93ab8f7f19fb09f25a6485a3b9e2bb640b77a18 (patch) | |
tree | f0a1b0849eada8b7c80bd2681fafbc42c438f972 | |
parent | Fix problem with screen not refreshing. (diff) | |
download | calp-b93ab8f7f19fb09f25a6485a3b9e2bb640b77a18.tar.gz calp-b93ab8f7f19fb09f25a6485a3b9e2bb640b77a18.tar.xz |
Fix crash when day has 0 events.
Diffstat (limited to '')
-rwxr-xr-x | main.scm | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -122,20 +122,21 @@ Event must have the DTSTART and DTEND attribute set." (make-string 32 #\─) (make-string 10 #\─)) - (let ((ev (list-ref events cur-event))) - (format #t "~a~%~aStart: ~a Slut: ~a~%~%~a~%" - (attr ev 'SUMMARY) - (or (and=> (attr ev 'LOCATION) (cut string-append "Plats: " <> "\n")) "") - (time->string (attr ev 'DTSTART) "~1 ~3") - (time->string (attr ev 'DTEND) "~1 ~3") - (string-join ; TODO replace this with a better text flower - (take-to ; This one destroys newlines used for layout - (string->wrapped-lines (or (attr ev 'DESCRIPTION) "") - #:line-width 60 - #:collapse-whitespace? #f) - 10) - (string #\newline)) - )) + (unless (null? events) + (let ((ev (list-ref events cur-event))) + (format #t "~a~%~aStart: ~a Slut: ~a~%~%~a~%" + (attr ev 'SUMMARY) + (or (and=> (attr ev 'LOCATION) (cut string-append "Plats: " <> "\n")) "") + (time->string (attr ev 'DTSTART) "~1 ~3") + (time->string (attr ev 'DTEND) "~1 ~3") + (string-join ; TODO replace this with a better text flower + (take-to ; This one destroys newlines used for layout + (string->wrapped-lines (or (attr ev 'DESCRIPTION) "") + #:line-width 60 + #:collapse-whitespace? #f) + 10) + (string #\newline)) + ))) ;; (format #t "c = ~c (~d)~%" char (char->integer char)) |