diff options
author | Case Duckworth | 2022-06-16 10:29:56 -0500 |
---|---|---|
committer | Case Duckworth | 2022-06-16 10:29:56 -0500 |
commit | 63c501ea109e648226e0274c3807b7b70dbf3d87 (patch) | |
tree | 6af987705f1dcdae976712d4ee22d5ec7ac2486a | |
parent | Convert arguments to numbers (diff) | |
download | qotd-63c501ea109e648226e0274c3807b7b70dbf3d87.tar.gz qotd-63c501ea109e648226e0274c3807b7b70dbf3d87.zip |
Fix string-length bug
-rwxr-xr-x | qotd.scm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qotd.scm b/qotd.scm index 394085d..da3aba8 100755 --- a/qotd.scm +++ b/qotd.scm | |||
@@ -47,7 +47,8 @@ An implementation of the QOTD protocol (RFC 865) | |||
47 | #f)) | 47 | #f)) |
48 | 48 | ||
49 | (define (ensure-final-newline str) | 49 | (define (ensure-final-newline str) |
50 | (cond ((char=? (string-ref str (- (string-length str) 1)) #\newline) str) | 50 | (cond ((not str) "\n") |
51 | ((char=? (string-ref str (- (string-length str) 1)) #\newline) str) | ||
51 | (else (string-append str "\n")))) | 52 | (else (string-append str "\n")))) |
52 | 53 | ||
53 | (define (main arguments) | 54 | (define (main arguments) |