emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/subed 9d54f39 005/389: Be more robust when getting start/s


From: ELPA Syncer
Subject: [nongnu] elpa/subed 9d54f39 005/389: Be more robust when getting start/stop time
Date: Fri, 3 Dec 2021 10:59:45 -0500 (EST)

branch: elpa/subed
commit 9d54f396fffadb1af26ca97d236e4e3883393237
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>

    Be more robust when getting start/stop time
---
 subed/subed-srt.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index 272750f..9d98cc7 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -91,18 +91,20 @@ after MSECS if there is one and its start time is >= MSECS +
     (subed-srt--subtitle-id)))
 
 (defun subed-srt--subtitle-msecs-start (&optional sub-id)
-  "Subtitle start time in milliseconds."
+  "Subtitle start time in milliseconds or nil if it can't be found."
   (let ((timestamp (save-excursion
-                     (subed-srt-move-to-subtitle-time-start sub-id)
-                     (buffer-substring (point) (+ (point) 
subed-srt--length-timestamp)))))
-    (subed-srt--timestamp-to-msecs timestamp)))
+                     (when (subed-srt-move-to-subtitle-time-start sub-id)
+                       (buffer-substring (point) (+ (point) 
subed-srt--length-timestamp))))))
+    (when timestamp
+      (subed-srt--timestamp-to-msecs timestamp))))
 
 (defun subed-srt--subtitle-msecs-stop (&optional sub-id)
-  "Subtitle stop time in milliseconds."
+  "Subtitle stop time in milliseconds or nil if it can't be found."
   (let ((timestamp (save-excursion
-                     (subed-srt-move-to-subtitle-time-stop sub-id)
-                     (buffer-substring (point) (+ (point) 
subed-srt--length-timestamp)))))
-    (subed-srt--timestamp-to-msecs timestamp)))
+                     (when (subed-srt-move-to-subtitle-time-stop sub-id)
+                       (buffer-substring (point) (+ (point) 
subed-srt--length-timestamp))))))
+    (when timestamp
+      (subed-srt--timestamp-to-msecs timestamp))))
 
 (defun subed-srt--subtitle-relative-point ()
   "Point relative to subtitle's ID, i.e. point within subtitle."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]