sfx2/source/view/viewprn.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 3ee0b45513c1c82849dc43e2f2b76d598a206685
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Oct 18 16:40:05 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Oct 22 11:15:43 2024 +0200

    tdf#163486: PVS: check mpViewShell
    
    V595    The 'mpViewShell' pointer was utilized before it was verified 
against nullptr. Check lines: 368, 380.
    
    Change-Id: I5e8d53d3503ade1814d7436e89f0f407f1d9ccfb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175164
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 3cc367f426506e3165dda06feeb20e0a9b4c6194)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175158
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index e1bc2c4ec915..319ecafbb7c8 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -365,11 +365,14 @@ void SfxPrinterController::jobFinished( 
css::view::PrintableState nState )
         case view::PrintableState_JOB_SPOOLED :
         case view::PrintableState_JOB_COMPLETED :
         {
-            SfxBindings& rBind = mpViewShell->GetViewFrame().GetBindings();
-            rBind.Invalidate( SID_PRINTDOC );
-            rBind.Invalidate( SID_PRINTDOCDIRECT );
-            rBind.Invalidate( SID_SETUPPRINTER );
-            bCopyJobSetup = ! m_bTempPrinter;
+            if (mpViewShell)
+            {
+                SfxBindings& rBind = mpViewShell->GetViewFrame().GetBindings();
+                rBind.Invalidate( SID_PRINTDOC );
+                rBind.Invalidate( SID_PRINTDOCDIRECT );
+                rBind.Invalidate( SID_SETUPPRINTER );
+                bCopyJobSetup = ! m_bTempPrinter;
+            }
             break;
         }
 

Reply via email to