branch: elpa/subed commit 52ee2ac4f75ebcf90219be78b53dd3b9136b113e Author: Random User <rnd...@posteo.de> Commit: Random User <rnd...@posteo.de>
Be more robust when getting subtitle's relative point --- subed/subed-srt.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/subed/subed-srt.el b/subed/subed-srt.el index 9d98cc7..e45b997 100644 --- a/subed/subed-srt.el +++ b/subed/subed-srt.el @@ -107,11 +107,12 @@ after MSECS if there is one and its start time is >= MSECS + (subed-srt--timestamp-to-msecs timestamp)))) (defun subed-srt--subtitle-relative-point () - "Point relative to subtitle's ID, i.e. point within subtitle." + "Point relative to subtitle's ID or nil if ID can't be found." (let ((start-point (save-excursion - (progn (subed-srt-move-to-subtitle-id) - (point))))) - (- (point) start-point))) + (when (subed-srt-move-to-subtitle-id) + (point))))) + (when start-point + (- (point) start-point)))) ;;; Traversing