check GetEditShell()

Change-Id: I975c7dca9ea569e326fc5d8670a078959ab9f093
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144730
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index d162bfb..bc3f9d7 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -918,19 +918,20 @@ bool SwPaM::HasReadonlySel(bool bFormView, bool const isReplace) const
        // Allow editing when the cursor/selection is fully inside of a legacy form field.
        bRet = !( pA != nullptr && !bAtStartA && !bAtStartB && pA == pB );

        if (bRet && rDoc.GetEditShell() && rDoc.GetEditShell()->CursorInsideContentControl())
        if (bRet)
        {
            // Also allow editing inside content controls in general, similar to form fields.
            // Specific types will be disabled below.
            bRet = false;
            if (const SwEditShell* pEditShell = rDoc.GetEditShell())
                bRet = !pEditShell->CursorInsideContentControl();
        }
    }

    if (!bRet)
    {
        // Paragraph Signatures and Classification fields are read-only.
        if (rDoc.GetEditShell())
            bRet = rDoc.GetEditShell()->IsCursorInParagraphMetadataField();
        if (const SwEditShell* pEditShell = rDoc.GetEditShell())
            bRet = pEditShell->IsCursorInParagraphMetadataField();
    }

    if (!bRet &&
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 566b225..132bbe6 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1782,9 +1782,10 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, SwCursorSkipMode nMode,

        if ( !Move( fnMove, fnGo ) )
        {
            SwEditShell* rSh = GetDoc().GetEditShell();
            if (rSh && rSh->GetViewOptions() &&
                    rSh->GetViewOptions()->IsShowOutlineContentVisibilityButton())
            const SwEditShell* pSh = GetDoc().GetEditShell();
            const SwViewOption* pViewOptions = pSh ? pSh->GetViewOptions() : nullptr;
            if (pViewOptions && pViewOptions->IsShowOutlineContentVisibilityButton())
            {
                // Fixes crash that occurs in documents with outline content folded at the end of
                // the document. When the cursor is at the end of the visible document and
                // right arrow key is pressed Move fails after moving the cursor to the
@@ -1792,6 +1793,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, SwCursorSkipMode nMode,
                // weird numbers to be displayed in the statusbar page number count. Left
                // arrow, when in this state, causes a crash without RestoredSavePos() added here.
                RestoreSavePos();
            }
            break;
        }

@@ -2103,7 +2105,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
            //Update cursor to change nUpDownX.
            if ( aOldPos.GetContentIndex() == nOffset )
            {
                GetDoc().GetEditShell()->UpdateCursor();
                if (SwEditShell* pSh = GetDoc().GetEditShell())
                    pSh->UpdateCursor();
                bRet = false;
            }
            else{
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 3c89c23..451c836 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -435,7 +435,7 @@ void ContentIdxStoreImpl::RestoreUnoCursors(updater_t const & rUpdater)
void ContentIdxStoreImpl::SaveShellCursors(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent)
{
    SwCursorShell* pShell = rDoc.GetEditShell();
    if( !pShell )
    if (!pShell)
        return;
    for(SwViewShell& rCurShell : pShell->GetRingContainer())
    {
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index 10de8efbe..13f85a2 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -199,8 +199,8 @@ IMPL_LINK_NOARG( DocumentTimerManager, DoIdleJobs, Timer*, void )
        m_rDoc.getIDocumentFieldsAccess().UpdateRefFields();  // References

        // Validate and update the paragraph signatures.
        if (m_rDoc.GetEditShell())
            m_rDoc.GetEditShell()->ValidateAllParagraphSignatures(true);
        if (SwEditShell* pSh = m_rDoc.GetEditShell())
            pSh->ValidateAllParagraphSignatures(true);

        pTmpRoot->EndAllAction();

diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 596634b..8cf23cc 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -91,9 +91,8 @@ void PaMCorrAbs( const SwPaM& rRange,
    SwPosition const aEnd( *rRange.End() );
    SwPosition const aNewPos( rNewPos );
    SwDoc& rDoc = aStart.GetNode().GetDoc();
    SwCursorShell *const pShell = rDoc.GetEditShell();

    if( pShell )
    if (SwCursorShell *const pShell = rDoc.GetEditShell())
    {
        for(const SwViewShell& rShell : pShell->GetRingContainer())
        {
@@ -249,8 +248,7 @@ void PaMCorrRel( const SwNode &rOldNode,

    const sal_Int32 nCntIdx = rNewPos.GetContentIndex() + nOffset;

    SwCursorShell const* pShell = rDoc.GetEditShell();
    if( pShell )
    if (SwCursorShell const* pShell = rDoc.GetEditShell())
    {
        for(const SwViewShell& rShell : pShell->GetRingContainer())
        {
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d75caf8..57e561e 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -897,7 +897,7 @@ void SwDoc::PrtOLENotify( bool bAll )
IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
{
    SwFEShell* pSh = static_cast<SwFEShell*>(GetEditShell());
    if( !pSh )
    if (!pSh)
        return;

    mbOLEPrtNotifyPending = mbAllOLENotify = false;
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 901b472..fdfe270 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -683,8 +683,8 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const

    pFormat->SetFormatAttr(rSet);

    SwEditShell *pShell = pDoc->GetEditShell();
    pDoc->SetRowSplit(*pShell->getShellCursor(false), SwFormatRowSplit(m_bRowSplit));
    if (SwEditShell *pShell = pDoc->GetEditShell())
        pDoc->SetRowSplit(*pShell->getShellCursor(false), SwFormatRowSplit(m_bRowSplit));

    table.SetRowsToRepeat(m_aRepeatHeading);
}
@@ -700,7 +700,7 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable &table)
        return;

    SwEditShell *pShell = pDoc->GetEditShell();
    std::unique_ptr<SwFormatRowSplit> pRowSplit = SwDoc::GetRowSplit(*pShell->getShellCursor(false));
    std::unique_ptr<SwFormatRowSplit> pRowSplit(pShell ? SwDoc::GetRowSplit(*pShell->getShellCursor(false)) : nullptr);
    m_bRowSplit = pRowSplit && pRowSplit->GetValue();
    pRowSplit.reset();

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 6699128..77f7a4d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1437,7 +1437,7 @@ bool SwDoc::TableToText( const SwTableNode* pTableNd, sal_Unicode cCh )
    // If this is triggered by SwUndoTableToText::Repeat() nobody ever deleted
    // the table cursor.
    SwEditShell* pESh = GetEditShell();
    if( pESh && pESh->IsTableMode() )
    if (pESh && pESh->IsTableMode())
        pESh->ClearMark();

    SwNodeRange aRg( *pTableNd, SwNodeOffset(0), *pTableNd->EndOfSectionNode() );
@@ -1828,8 +1828,7 @@ void SwDoc::DeleteRow( const SwCursor& rCursor )
        if( aFndBox.GetLines().empty() )
            return;

        SwEditShell* pESh = GetEditShell();
        if( pESh )
        if (SwEditShell* pESh = GetEditShell())
        {
            pESh->KillPams();
            // FIXME: actually we should be iterating over all Shells!
@@ -1910,8 +1909,7 @@ void SwDoc::DeleteCol( const SwCursor& rCursor )
    // The Cursors need to be removed from the to-be-deleted range.
    // Always place them after/on top of the Table; they are always set
    // to the old position via the document position.
    SwEditShell* pESh = GetEditShell();
    if( pESh )
    if (SwEditShell* pESh = GetEditShell())
    {
        const SwNode* pNd = rCursor.GetPointNode().FindTableBoxStartNode();
        pESh->ParkCursor( *pNd );
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index dbd9d5b..47b4eb6 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1728,9 +1728,10 @@ void SwUndoParagraphSigning::Insert()
    // Prevent validation since this will trigger a premature validation
    // upon inserting, but before setting the metadata.
    SwEditShell* pEditSh = m_rDoc.GetEditShell();
    const bool bOldValidationFlag = pEditSh->SetParagraphSignatureValidation(false);
    const bool bOldValidationFlag = pEditSh && pEditSh->SetParagraphSignatureValidation(false);
    comphelper::ScopeGuard const g([&] () {
            pEditSh->SetParagraphSignatureValidation(bOldValidationFlag);
            if (pEditSh)
                pEditSh->SetParagraphSignatureValidation(bOldValidationFlag);
            m_rDoc.GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
        });

@@ -1747,9 +1748,10 @@ void SwUndoParagraphSigning::Remove()
    // Prevent validation since this will trigger a premature validation
    // upon removing.
    SwEditShell* pEditSh = m_rDoc.GetEditShell();
    const bool bOldValidationFlag = pEditSh->SetParagraphSignatureValidation(false);
    const bool bOldValidationFlag = pEditSh && pEditSh->SetParagraphSignatureValidation(false);
    comphelper::ScopeGuard const g([&] () {
            pEditSh->SetParagraphSignatureValidation(bOldValidationFlag);
            if (pEditSh)
                pEditSh->SetParagraphSignatureValidation(bOldValidationFlag);
            m_rDoc.GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
        });

diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 55b7d45..8f01b25 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -114,8 +114,7 @@ void SwIntrnlRefLink::Closed()
    {
        // advise goes, convert all fields into text?
        SwViewShell* pSh = m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
        SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
        if( pESh )
        if (SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell())
        {
            pESh->StartAllAction();
            pESh->FieldToText(&m_rFieldType);
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 3c0c5a4..d4348fe 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -361,8 +361,8 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
        // don't need to remove the row frames in Show Changes mode
        if ( !bRecordAndHideChanges )
        {
            SwEditShell* pEditShell = GetDoc()->GetEditShell();
            pEditShell->Delete(false);
            if (SwEditShell* pEditShell = GetDoc()->GetEditShell())
                pEditShell->Delete(false);

            EndAllActionAndCall();
            EndUndo(bCompleteTable ? SwUndoId::UI_TABLE_DELETE : SwUndoId::ROW_DELETE);
@@ -487,7 +487,8 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
                    pWrtShell->UpdateCursor();
                }

                pEditShell->Delete(false);
                if (pEditShell)
                    pEditShell->Delete(false);
            }

            SwNodeOffset nIdx;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 0bae8e4..e47c682 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3897,12 +3897,17 @@ SwFrame* GetFrameOfModify(SwRootFrame const*const pLayout, sw::BroadcastingModif
bool IsExtraData( const SwDoc *pDoc )
{
    const SwLineNumberInfo &rInf = pDoc->GetLineNumberInfo();
    return rInf.IsPaintLineNumbers() ||
    if (rInf.IsPaintLineNumbers() ||
           rInf.IsCountInFlys() ||
           (static_cast<sal_Int16>(SW_MOD()->GetRedlineMarkPos()) != text::HoriOrientation::NONE &&
            !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty()) ||
            (pDoc->GetEditShell() && pDoc->GetEditShell()->GetViewOptions() &&
             pDoc->GetEditShell()->GetViewOptions()->IsShowOutlineContentVisibilityButton());
            !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty()))
    {
        return true;
    }

    const SwEditShell* pSh = pDoc->GetEditShell();
    const SwViewOption* pViewOptions = pSh ? pSh->GetViewOptions() : nullptr;
    return pViewOptions && pViewOptions->IsShowOutlineContentVisibilityButton();
}

// OD 22.09.2003 #110978#
diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx
index 97fcc55..b626c94 100644
--- a/sw/source/core/sw3io/swacorr.cxx
+++ b/sw/source/core/sw3io/swacorr.cxx
@@ -65,7 +65,11 @@ bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >&  rStg,
                                 SfxObjectShell& rObjSh, OUString& rLong )
{
    SwDocShell* pDShell = dynamic_cast<SwDocShell*>(&rObjSh);
    if( !pDShell )
    if (!pDShell)
        return false;

    SwEditShell* pEditSh = pDShell->GetEditShell();
    if (!pEditSh)
        return false;

    ErrCode nRet = ERRCODE_NONE;
@@ -77,7 +81,7 @@ bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >&  rStg,
    nRet = aBlk.BeginPutDoc( rShort, rShort );
    if( ! nRet.IsError() )
    {
        pDShell->GetEditShell()->CopySelToDoc( *pDoc );
        pEditSh->CopySelToDoc(*pDoc);
        nRet = aBlk.PutDoc();
        aBlk.AddName ( rShort, rShort );
        if( ! nRet.IsError() )
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 59950ce..51c8528 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1103,6 +1103,8 @@ void SwTextNode::SetLanguageAndFont( const SwPaM &rPaM,
    const vcl::Font *pFont,  sal_uInt16 nFontWhichId )
{
    SwEditShell *pEditShell = GetDoc().GetEditShell();
    if (!pEditShell)
        return;
    SfxItemSet aSet(pEditShell->GetAttrPool(), nLangWhichId, nLangWhichId );
    if (pFont)
        aSet.MergeRange(nFontWhichId, nFontWhichId); // Keep it sorted
@@ -1207,16 +1209,18 @@ bool SwTextNode::Convert( SwConversionArgs &rArgs )
                aCurPaM.GetPoint()->SetContent(nBegin + nLen);

                // check script type of selected text
                SwEditShell *pEditShell = GetDoc().GetEditShell();
                pEditShell->Push();             // save current cursor on stack
                pEditShell->SetSelection( aCurPaM );
                bool bIsAsianScript = (SvtScriptType::ASIAN == pEditShell->GetScriptType());
                pEditShell->Pop(SwCursorShell::PopMode::DeleteCurrent); // restore cursor from stack

                if (!bIsAsianScript && rArgs.bAllowImplicitChangesForNotConvertibleText)
                if (SwEditShell *pEditShell = GetDoc().GetEditShell())
                {
                    // Store for later use
                    aImplicitChanges.emplace_back(nBegin, nBegin+nLen);
                    pEditShell->Push();             // save current cursor on stack
                    pEditShell->SetSelection( aCurPaM );
                    bool bIsAsianScript = (SvtScriptType::ASIAN == pEditShell->GetScriptType());
                    pEditShell->Pop(SwCursorShell::PopMode::DeleteCurrent); // restore cursor from stack

                    if (!bIsAsianScript && rArgs.bAllowImplicitChangesForNotConvertibleText)
                    {
                        // Store for later use
                        aImplicitChanges.emplace_back(nBegin, nBegin+nLen);
                    }
                }
                nBegin = nChPos;    // start of next language portion
            }
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index c474dd6..84fcd4f 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -666,8 +666,7 @@ bool UndoManager::impl_DoUndoRedo(UndoOrRedoType undoOrRedo, size_t nUndoOffset)

    UnoActionContext c(& rDoc); // exception-safe StartAllAction/EndAllAction

    SwEditShell *const pEditShell( rDoc.GetEditShell() );

    SwEditShell *const pEditShell(rDoc.GetEditShell());
    OSL_ENSURE(pEditShell, "sw::UndoManager needs a SwEditShell!");
    if (!pEditShell)
    {
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 0463b66..b812821 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -249,8 +249,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext)
    if( pUpdateTOX )
    {
        // initiate formatting
        SwEditShell* pESh = rDoc.GetEditShell();
        if( pESh )
        if (SwEditShell* pESh = rDoc.GetEditShell())
            pESh->CalcLayout();

        // insert page numbers
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index ce64603..4621bb8 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -312,12 +312,19 @@ void SwUndoInsTable::RedoImpl(::sw::UndoRedoContext & rContext)
{
    SwDoc & rDoc = rContext.GetDoc();

    SwEditShell *const pEditShell(rDoc.GetEditShell());
    OSL_ENSURE(pEditShell, "SwUndoInsTable::RedoImpl needs a SwEditShell!");
    if (!pEditShell)
    {
        throw uno::RuntimeException();
    }

    SwPosition const aPos(rDoc.GetNodes(), m_nStartNode);
    const SwTable* pTable = rDoc.InsertTable( m_aInsTableOptions, aPos, m_nRows, m_nColumns,
                                            m_nAdjust,
                                            m_pAutoFormat.get(),
                                            m_oColumnWidth ? &*m_oColumnWidth : nullptr );
    rDoc.GetEditShell()->MoveTable( GotoPrevTable, fnTableStart );
    pEditShell->MoveTable( GotoPrevTable, fnTableStart );
    static_cast<SwFrameFormat*>(pTable->GetFrameFormat())->SetFormatName( m_sTableName );
    SwTableNode* pTableNode = rDoc.GetNodes()[m_nStartNode]->GetTableNode();

diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 71e69a9..d81ed0f 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2136,8 +2136,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
                SwDoc* pDoc = pFormat->GetDoc();
                if (pDoc)
                {
                    const SwEditShell* pEditShell = pDoc->GetEditShell();
                    if (pEditShell)
                    if (const SwEditShell* pEditShell = pDoc->GetEditShell())
                    {
                        SwFrame* pCurrFrame = pEditShell->GetCurrFrame(false);
                        GraphicAttr aGraphicAttr;
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index eb80794..e3dfe4b 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -504,8 +504,7 @@ void SwDocStyleSheet::SetGrabBagItem(const uno::Any& rVal)
    {
        dynamic_cast<SwDocStyleSheetPool&>(*m_pPool).InvalidateIterator();
        m_pPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetModified, *this));
        SwEditShell* pSh = m_rDoc.GetEditShell();
        if (pSh)
        if (SwEditShell* pSh = m_rDoc.GetEditShell())
            pSh->CallChgLnk();
    }
}
@@ -615,8 +614,7 @@ void SwDocStyleSheet::SetHidden( bool bValue )
        // calling pPool->First() here would be quite slow...
        dynamic_cast<SwDocStyleSheetPool&>(*m_pPool).InvalidateIterator(); // internal list has to be updated
        m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
        SwEditShell* pSh = m_rDoc.GetEditShell();
        if( pSh )
        if (SwEditShell* pSh = m_rDoc.GetEditShell())
            pSh->CallChgLnk();
    }
}
@@ -1148,8 +1146,7 @@ bool  SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
    {
        m_pPool->First(nFamily);  // internal list has to be updated
        m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
        SwEditShell* pSh = m_rDoc.GetEditShell();
        if( pSh )
        if (SwEditShell* pSh = m_rDoc.GetEditShell())
            pSh->CallChgLnk();
    }
    return true;
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index 9b85126..5f86100 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -49,8 +49,8 @@

namespace sw::sidebar
{
static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& aStore,
                       sal_Int32& rParIdx);
static void UpdateTree(SwDocShell& rDocSh, SwEditShell& rEditSh,
                       std::vector<svx::sidebar::TreeNode>& aStore, sal_Int32& rParIdx);

std::unique_ptr<PanelLayout> WriterInspectorTextPanel::Create(weld::Widget* pParent)
{
@@ -74,9 +74,9 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)

    // Update panel on start
    std::vector<svx::sidebar::TreeNode> aStore;
    if (pDocSh && pDocSh->GetDoc()->GetEditShell()
        && pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetPointNode().GetTextNode())
        UpdateTree(pDocSh, aStore, m_nParIdx);
    SwEditShell* pEditSh = pDocSh ? pDocSh->GetDoc()->GetEditShell() : nullptr;
    if (pEditSh && pEditSh->GetCursor()->GetPointNode().GetTextNode())
        UpdateTree(*pDocSh, *pEditSh, aStore, m_nParIdx);
    updateEntries(aStore, m_nParIdx);
}

@@ -519,11 +519,11 @@ static void InsertValues(const css::uno::Reference<css::uno::XInterface>& rSourc
        });
}

static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& aStore,
                       sal_Int32& rParIdx)
static void UpdateTree(SwDocShell& rDocSh, SwEditShell& rEditSh,
                       std::vector<svx::sidebar::TreeNode>& aStore, sal_Int32& rParIdx)
{
    SwDoc* pDoc = pDocSh->GetDoc();
    SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
    SwDoc* pDoc = rDocSh.GetDoc();
    SwPaM* pCursor = rEditSh.GetCursor();
    svx::sidebar::TreeNode aCharDFNode;
    svx::sidebar::TreeNode aCharNode;
    svx::sidebar::TreeNode aParaNode;
@@ -566,7 +566,7 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& 

    InsertValues(xRange, aIsDefined, aCharDFNode, false, aHiddenProperties, aFieldsNode);

    uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocSh->GetBaseModel(),
    uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(rDocSh.GetBaseModel(),
                                                                         uno::UNO_QUERY);
    uno::Reference<container::XNameAccess> xStyleFamilies
        = xStyleFamiliesSupplier->getStyleFamilies();
@@ -626,7 +626,7 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& 
                 aParaNode.children.end()); // Parent style should be first then children

    // Collect bookmarks at character position
    uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(pDocSh->GetBaseModel(),
    uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(rDocSh.GetBaseModel(),
                                                                uno::UNO_QUERY);

    uno::Reference<container::XIndexAccess> xBookmarks(xBookmarksSupplier->getBookmarks(),
@@ -662,7 +662,7 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& 
    }

    // Collect sections at character position
    uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(pDocSh->GetBaseModel(),
    uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(rDocSh.GetBaseModel(),
                                                                      uno::UNO_QUERY);

    uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(),
@@ -738,9 +738,9 @@ IMPL_LINK(WriterInspectorTextPanel, AttrChangedNotify, LinkParamNone*, pLink, vo
    SwDocShell* pDocSh = m_pShell->GetDoc()->GetDocShell();
    std::vector<svx::sidebar::TreeNode> aStore;

    if (pDocSh && pDocSh->GetDoc()->GetEditShell()
        && pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetPointNode().GetTextNode())
        UpdateTree(pDocSh, aStore, m_nParIdx);
    SwEditShell* pEditSh = pDocSh ? pDocSh->GetDoc()->GetEditShell() : nullptr;
    if (pEditSh && pEditSh->GetCursor()->GetPointNode().GetTextNode())
        UpdateTree(*pDocSh, *pEditSh, aStore, m_nParIdx);

    updateEntries(aStore, m_nParIdx);
}
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index a304730..2f53b0f 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -490,8 +490,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
        {
            bool bIsKern = *o3tl::doAccess<bool>(rValue);
            mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, bIsKern);
            SwEditShell* pEditSh = mpDoc->GetEditShell();
            if(pEditSh)
            if (SwEditShell* pEditSh = mpDoc->GetEditShell())
                pEditSh->ChgHyphenation();
        }
        break;