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

New commits:
commit 6737f3c00ce0752977f9159abd080f64640d449a
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Jul 4 14:23:20 2023 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Jul 5 11:23:54 2023 +0200

    sfx2: fix crash in SfxViewShell::StartPrint
    
    See 
https://crashreport.libreoffice.org/stats/signature/SfxViewShell::StartPrint(com::sun::star::uno::Sequence%3Ccom::sun::star::beans::PropertyValue%3E%20const%20&,bool,bool)
    
    Change-Id: I3d10414d4cfd027bf80ceaf6692bb7f92269f6c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153965
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 3502f5147b9102d37459c373ee07e052fd267db7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153990
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 9476dd22edec..885f1bb31346 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -609,8 +609,11 @@ void SfxViewShell::StartPrint( const uno::Sequence < 
beans::PropertyValue >& rPr
     css::beans::PropertyValue* pJobNameVal = 
xNewController->getValue("JobName");
     if (!pJobNameVal)
     {
-        xNewController->setValue("JobName", 
Any(GetObjectShell()->GetTitle(1)));
-        xNewController->setPrinterModified(mbPrinterSettingsModified);
+        if (SfxObjectShell* pDoc = GetObjectShell())
+        {
+            xNewController->setValue("JobName", Any(pDoc->GetTitle(1)));
+            xNewController->setPrinterModified(mbPrinterSettingsModified);
+        }
     }
 }
 

Reply via email to