[Libreoffice-commits] core.git: sfx2/source

Stephan Bergmann sbergman at redhat.com
Thu Jul 3 13:29:43 PDT 2014


 sfx2/source/view/printer.cxx |    4 ++++
 sfx2/source/view/viewprn.cxx |   15 +++++----------
 2 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 3bd78cb6dbc89cbbddb0fcf020d39abb610a99d0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jul 3 22:29:10 2014 +0200

    error: reference cannot be bound to dereferenced null pointer
    
    Change-Id: I4a5c83ba0f1e741104edc933459e7aea9c4aac1f

diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index ba4f4eb..94bb8c4 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -109,6 +109,7 @@ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions ) :
     bKnown(true)
 
 {
+    assert(pOptions);
     pImpl = new SfxPrinter_Impl;
 }
 
@@ -121,6 +122,7 @@ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions,
     pOptions        ( pTheOptions )
 
 {
+    assert(pOptions);
     pImpl = new SfxPrinter_Impl;
     bKnown = GetName() == rTheOrigJobSetup.GetPrinterName();
 
@@ -138,6 +140,7 @@ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions,
     bKnown          ( GetName() == rPrinterName )
 
 {
+    assert(pOptions);
     pImpl = new SfxPrinter_Impl;
 }
 
@@ -149,6 +152,7 @@ SfxPrinter::SfxPrinter( const SfxPrinter& rPrinter ) :
     pOptions( rPrinter.GetOptions().Clone() ),
     bKnown  ( rPrinter.IsKnown() )
 {
+    assert(pOptions);
     SetJobSetup( rPrinter.GetJobSetup() );
     SetPrinterProps( &rPrinter );
     SetMapMode( rPrinter.GetMapMode() );
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 267ab28..7ef21f9 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -478,16 +478,11 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
     SfxPrinter *pDocPrinter = GetPrinter();
 
     // Evaluate Printer Options
-    bool bOriToDoc = false;
-    bool bSizeToDoc = false;
-    if ( &pDocPrinter->GetOptions() )
-    {
-        sal_uInt16 nWhich = GetPool().GetWhich(SID_PRINTER_CHANGESTODOC);
-        const SfxFlagItem *pFlagItem = 0;
-        pDocPrinter->GetOptions().GetItemState( nWhich, false, (const SfxPoolItem**) &pFlagItem );
-        bOriToDoc = pFlagItem ? (pFlagItem->GetValue() & SFX_PRINTER_CHG_ORIENTATION) : sal_False;
-        bSizeToDoc = pFlagItem ? (pFlagItem->GetValue() & SFX_PRINTER_CHG_SIZE) : sal_False;
-    }
+    sal_uInt16 nWhich = GetPool().GetWhich(SID_PRINTER_CHANGESTODOC);
+    const SfxFlagItem *pFlagItem = 0;
+    pDocPrinter->GetOptions().GetItemState( nWhich, false, (const SfxPoolItem**) &pFlagItem );
+    bool bOriToDoc = pFlagItem && (pFlagItem->GetValue() & SFX_PRINTER_CHG_ORIENTATION);
+    bool bSizeToDoc = pFlagItem && (pFlagItem->GetValue() & SFX_PRINTER_CHG_SIZE);
 
     // Determine the previous format and size
     Orientation eOldOri = pDocPrinter->GetOrientation();


More information about the Libreoffice-commits mailing list