From b3c3d8a232303f296db0dd8786e8e7fb1aba6353 Mon Sep 17 00:00:00 2001 From: cage Date: Mon, 15 Mar 2021 18:33:16 +0100 Subject: [PATCH] - prevented crash when removing two (or more) statuses that reblogged the same status. When more than one statuses points to the same reblogged status and more the one of the formers is deleted the first deletion will remove the reblogged status as well and the second will try to remove the same (already removed from db) status. This makes the program crash. --- src/db.lisp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/db.lisp b/src/db.lisp index 9f8222b..62d37d4 100644 --- a/src/db.lisp +++ b/src/db.lisp @@ -2320,9 +2320,19 @@ where all parent messages are saved." (let ((marked-to-delete (statuses-marked-to-delete timeline folder))) (loop for status-to-delete in marked-to-delete do (when-let ((reblogged-id (row-message-reblog-id status-to-delete))) - (delete-status +default-reblogged-timeline+ - +default-reblogged-folder+ - reblogged-id)) + ;; sometimes a status is reblogged by more than + ;; one of the statuses that you downloaded and if + ;; you delete at least two of the latter the first + ;; deletion will remove also the reblogged status, + ;; so the other statuses should skip deletion of + ;; the reblogged one as it has been already + ;; removed + (when (find-status-id-folder-timeline reblogged-id + +default-reblogged-folder+ + +default-reblogged-timeline+) + (delete-status +default-reblogged-timeline+ + +default-reblogged-folder+ + reblogged-id))) (delete-status timeline folder (row-message-status-id status-to-delete)))))))) (defun max-username-length (timeline-type folder)