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

New commits:
commit 3cc367f426506e3165dda06feeb20e0a9b4c6194
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Oct 18 16:40:05 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Oct 18 21:46:19 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>

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