Check for EOF when reading subtitle lines.
authorDavid Thompson <davet@gnu.org>
Thu, 5 Feb 2015 16:57:42 +0000 (11:57 -0500)
committerDavid Thompson <davet@gnu.org>
Thu, 5 Feb 2015 16:57:42 +0000 (11:57 -0500)
* srt2vtt (read-sub-rip): Test for EOF object.

srt2vtt

diff --git a/srt2vtt b/srt2vtt
index 8107e755149fe15f934092c8f03ec16e07f53137..a4cb576042aabd05915205eb495a5116608c1dd0 100755 (executable)
--- a/srt2vtt
+++ b/srt2vtt
@@ -66,9 +66,10 @@ two values: the start time and the end time.  Valid input looks like
                ((start end) (parse-time-span (read-line port)))
                ((lines) (let loop ((lines '()))
                           (let ((line (read-line port)))
-                            (if (and (string-null? line)
-                                     ;; A subtitle may be a blank line!
-                                     (not (null? lines)))
+                            (if (or (eof-object? line)
+                                    (and (string-null? line)
+                                         ;; A subtitle may be a blank line!
+                                         (not (null? lines))))
                                 lines
                                 (loop (cons line lines)))))))
     (make-subtitle id start end lines)))