aboutsummaryrefslogtreecommitdiff
path: root/main.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-03-19 12:40:58 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-03-19 12:40:58 +0100
commitb93ab8f7f19fb09f25a6485a3b9e2bb640b77a18 (patch)
treef0a1b0849eada8b7c80bd2681fafbc42c438f972 /main.scm
parentFix problem with screen not refreshing. (diff)
downloadcalp-b93ab8f7f19fb09f25a6485a3b9e2bb640b77a18.tar.gz
calp-b93ab8f7f19fb09f25a6485a3b9e2bb640b77a18.tar.xz
Fix crash when day has 0 events.
Diffstat (limited to '')
-rwxr-xr-xmain.scm29
1 files changed, 15 insertions, 14 deletions
diff --git a/main.scm b/main.scm
index 32b01086..54d23d19 100755
--- a/main.scm
+++ b/main.scm
@@ -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))