branch: elpa/subed
commit 2b3f242dcc8161b1348101fb49524529a0370c1b
Author: Sacha Chua <[email protected]>
Commit: Sacha Chua <[email protected]>
subed-vtt: Check for end of buffer
* subed/subed-vtt.el (subed--subtitle-id-at-msecs):
Check for end of buffer.
---
subed/subed-vtt.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/subed/subed-vtt.el b/subed/subed-vtt.el
index 553bb694d5..b1a3e8cfa6 100644
--- a/subed/subed-vtt.el
+++ b/subed/subed-vtt.el
@@ -105,13 +105,16 @@ format-specific function for MAJOR-MODE."
(subed-forward-subtitle-time-start))
;; Move to first subtitle that starts at or after MSECS
(catch 'subtitle-id
- (while (<= (or (subed-subtitle-msecs-start) -1) msecs)
+ (while (not (eobp))
+ (if (<= (or (subed-subtitle-msecs-start) -1) msecs)
;; If stop time is >= MSECS, we found a match
(let ((cur-sub-end (subed-subtitle-msecs-stop)))
- (when (and cur-sub-end (>= cur-sub-end msecs))
- (throw 'subtitle-id (subed-subtitle-id))))
+ (if (and cur-sub-end (>= cur-sub-end msecs))
+ (throw 'subtitle-id (subed-subtitle-id))
(unless (subed-forward-subtitle-id)
- (throw 'subtitle-id nil))))))
+ (throw 'subtitle-id nil))))
+ (unless (subed-forward-subtitle-id)
+ (throw 'subtitle-id nil)))))))
;;; Traversing