sw/source/uibase/misc/redlndlg.cxx |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit fc5833b86016b0a940dd87d43dbe490ba1308dfe
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jun 1 11:58:32 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Jun 1 16:02:52 2022 +0200

    Related: tdf#149408 various crashes seen in redline panel
    
    with this writer in calc ole case
    
    Change-Id: I1ecd7725703674cc1bcfc9b3d411ec890bfe4bcc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135237
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 9cc010c288ec..2b12439494b8 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -207,7 +207,8 @@ SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
 
 void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart)
 {
-    SwWait aWait( *::GetActiveView()->GetDocShell(), false );
+    SwView *pView = ::GetActiveView();
+    std::unique_ptr<SwWait> xWait(pView ? new SwWait(*pView->GetDocShell(), 
false) : nullptr);
     weld::TreeView& rTreeView = m_pTable->GetWidget();
     m_aUsedSeqNo.clear();
 
@@ -235,18 +236,19 @@ void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type 
nStart)
 
 void SwRedlineAcceptDlg::InitAuthors()
 {
-    SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
-
     if (!m_xTabPagesCTRL)
         return;
 
+    SwView *pView = ::GetActiveView();
+    SwWrtShell* pSh = pView ? pView->GetWrtShellPtr() : nullptr;
+
     SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage();
 
     std::vector<OUString> aStrings;
     OUString sOldAuthor(pFilterPage->GetSelectedAuthor());
     pFilterPage->ClearAuthors();
 
-    SwRedlineTable::size_type nCount = pSh->GetRedlineCount();
+    SwRedlineTable::size_type nCount = pSh ? pSh->GetRedlineCount() : 0;
 
     m_bOnlyFormatedRedlines = true;
     bool bIsNotFormated = false;
@@ -277,7 +279,7 @@ void SwRedlineAcceptDlg::InitAuthors()
         pFilterPage->SelectAuthor(aStrings[0]);
 
     weld::TreeView& rTreeView = m_pTable->GetWidget();
-    bool const bEnable = !pSh->GetDoc()->GetDocShell()->IsReadOnly()
+    bool const bEnable = pSh && !pSh->GetDoc()->GetDocShell()->IsReadOnly()
         && rTreeView.n_children() != 0
         && 
!pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
     bool bSel = rTreeView.get_selected(nullptr);
@@ -725,7 +727,10 @@ void 
SwRedlineAcceptDlg::RemoveParents(SwRedlineTable::size_type nStart, SwRedli
 
 void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, 
SwRedlineTable::size_type nEnd)
 {
-    SwView *pView   = ::GetActiveView();
+    SwView *pView = ::GetActiveView();
+    if (!pView)
+        return;
+
     SwWrtShell* pSh = pView->GetWrtShellPtr();
     bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
 

Reply via email to