summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-07-03 22:29:10 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-07-03 22:29:10 +0200
commit3bd78cb6dbc89cbbddb0fcf020d39abb610a99d0 (patch)
treeb78c2cb4e870920db9a28950a9771b8fd1b93679 /sfx2
parent7649a14222dc1e5a7e01ed7c1d5e45a78143b41b (diff)
error: reference cannot be bound to dereferenced null pointer
Change-Id: I4a5c83ba0f1e741104edc933459e7aea9c4aac1f
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/printer.cxx4
-rw-r--r--sfx2/source/view/viewprn.cxx15
2 files changed, 9 insertions, 10 deletions
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index ba4f4ebc3a31..94bb8c49705c 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 267ab28c4e1f..7ef21f9582cc 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();