sw/source/uibase/sidebar/CommentsPanel.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 1a09da6c7ed13139586e5400fea223bac65fcac6
Author:     Mohit Marathe <mohitmara...@proton.me>
AuthorDate: Fri Sep 27 16:49:39 2024 +0530
Commit:     Sarper Akdemir <sarper.akde...@allotropia.de>
CommitDate: Wed Oct 2 11:59:21 2024 +0200

    sw: give warning when comment cannot be deleted in comments panel
    
    Instead of crashing LO, this patch gives a warning if it is not
    able to find the comment or thread to be deleted
    
    Change-Id: Ia36e1b31929cea6c70322265b3062b5b8458291f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174107
    Tested-by: Jenkins
    Reviewed-by: Sarper Akdemir <sarper.akde...@allotropia.de>

diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx 
b/sw/source/uibase/sidebar/CommentsPanel.cxx
index 6bf6d8336a70..eb4a40747fd1 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.cxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.cxx
@@ -542,11 +542,19 @@ void CommentsPanel::deleteComment(sal_uInt32 nId)
     sal_uInt32 nRootId = getPostItId(pRootNote);
 
     if (mpThreadsMap.find(nRootId) == mpThreadsMap.end())
-        throw std::runtime_error("Cannot delete comment: Thread does not 
exist");
+    {
+        SAL_WARN("sw",
+                 "Comments Panel is unable to delete comment: Referenced 
thread does not exist!");
+        return;
+    }
     auto& pComment = mpCommentsMap[nId];
     auto& pThread = mpThreadsMap[nRootId];
     if (!pComment)
-        throw std::runtime_error("Cannot delete comment: Comment does not 
exist");
+    {
+        SAL_WARN("sw",
+                 "Comments Panel is unable to delete comment: Referenced 
comment does not exist!");
+        return;
+    }
 
     pThread->getCommentBoxWidget()->move(pComment->get_widget(), nullptr);
     mpCommentsMap.erase(nId);

Reply via email to