aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2023-10-22 11:08:00 +0200
committermarty hiatt <martianhiatus@riseup.net>2023-10-22 11:08:00 +0200
commit506ec82941fbc4a208ae9ae14d89d1bfc0ed3735 (patch)
treee8a0a5d107174fd3fd04410f9547c4c24ad991dd
parentcd2d6f23b4f7af63df3000f2fb68227c22bc8dee (diff)
tl--prev-toot-id: don't assume our funs return anything.
fixes a bug that would break thread loading, perhaps because an ancestor toot wasn't there when it was supposed to be, so we were check for prev id when there was no prev toot. maybe caused by viewing threads that include toots by ppl on blocked servers, which don't display.
-rw-r--r--lisp/mastodon-tl.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 68147d9..cb48bc6 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1297,10 +1297,13 @@ Runs `mastodon-tl--render-text' and fetches poll or media."
(defun mastodon-tl--prev-toot-id ()
"Return the id of the last toot inserted into the buffer."
- (let ((prev-pos
- (1- (save-excursion
- (previous-single-property-change (point) 'base-toot-id)))))
- (get-text-property prev-pos 'base-toot-id)))
+ (let* ((prev-change
+ (save-excursion
+ (previous-single-property-change (point) 'base-toot-id)))
+ (prev-pos
+ (when prev-change (1- prev-change))))
+ (when prev-pos
+ (get-text-property prev-pos 'base-toot-id))))
(defun mastodon-tl--after-reply-status (reply-to-id)
"T if REPLY-TO-ID is equal to that of the last toot inserted in the bufer."