sw/source/core/edit/edredln.cxx |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 17a6b3a8f8afdf213f04f30f7ba50865ef645fc4
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Mar 11 11:50:06 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Mar 11 13:38:03 2025 +0100

    sw: fix warning C6011: Dereferencing NULL pointer 'pDocSh'
    
    after
    commit ab91358566ccf31f7a9ac57f1c32a9c62840f5d5
    Author: Miklos Vajna <vmik...@collabora.com>
    Date:   Mon Mar 10 10:18:10 2025 +0100
    
        cool#11226 sw per-view redline on: support this-view <-> all-views 
transition
    
    Catch by https://ci.libreoffice.org/job/lo_tb_master_win_analyze/
    
C:/cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win_analyze/sw/source/core/edit/edredln.cxx(44):
 error C2220: the following warning is treated as an error
    C:    make[1]: *** 
[C:/cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win_analyze/solenv/gbuild/LinkTarget.mk:339:
 
C:/cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win_analyze/workdir/CxxObject/sw/source/core/edit/edredln.o]
 Error 2
    
    Change-Id: I0f191ee2bf583ba0fda5c9868679996baf480ca8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182767
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index 379f12a6932e..037f8e0558f2 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -32,14 +32,16 @@ RedlineFlags SwEditShell::GetRedlineFlags() const
 
 void SwEditShell::SetRedlineFlags( RedlineFlags eMode, bool bRecordAllViews )
 {
-    SwDocShell* pDocSh = GetDoc()->GetDocShell();
-    bool bRecordModeChange = bRecordAllViews != 
pDocSh->IsChangeRecording(nullptr, bRecordAllViews);
-    if( eMode != GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() || 
bRecordModeChange )
+    if (SwDocShell* pDocSh = GetDoc()->GetDocShell())
     {
-        CurrShell aCurr( this );
-        StartAllAction();
-        GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eMode, 
bRecordAllViews, bRecordModeChange );
-        EndAllAction();
+        bool bRecordModeChange = bRecordAllViews != 
pDocSh->IsChangeRecording(nullptr, bRecordAllViews);
+        if( eMode != GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() 
|| bRecordModeChange )
+        {
+            CurrShell aCurr( this );
+            StartAllAction();
+            GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eMode, 
bRecordAllViews, bRecordModeChange );
+            EndAllAction();
+        }
     }
 }
 

Reply via email to