diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-21 21:50:03 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-21 23:11:39 +0200 |
commit | ebab5c3cdffd5ef51919ff00cd20654a6abdf966 (patch) | |
tree | f87588b6291485c1e5c7c830402381046bdaeda2 /sd/source/filter/ppt/pptin.cxx | |
parent | 2e682faf5fccd932f57aafc8f50b4654811cdd91 (diff) |
tdf#120703 (PVS): missing nullptr check; redundant nullptr check
V1004 The 'pDocShell' pointer was used unsafely after it was verified
against nullptr. Check lines: 258, 561.
V668 There is no sense in testing the 'pFrameView' pointer against null,
as the memory was allocated using the 'new' operator. The exception
will be generated in the case of memory allocation error.
Change-Id: I768d3f56dbd5edd070da9d989ab2d85c4b8e868f
Reviewed-on: https://gerrit.libreoffice.org/62149
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/source/filter/ppt/pptin.cxx')
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 16ed1e845c9a..4724a6f3df70 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -548,18 +548,21 @@ bool ImplSdPPTImport::Import() } } - Size aVisAreaSize; - switch ( aUserEditAtom.eLastViewType ) + if (pDocShell) { - case PptViewTypeEnum::Notes: - case PptViewTypeEnum::NotesMaster: - aVisAreaSize = aDocAtom.GetNotesPageSize(); - break; - default : - aVisAreaSize = aDocAtom.GetSlidesPageSize(); + Size aVisAreaSize; + switch ( aUserEditAtom.eLastViewType ) + { + case PptViewTypeEnum::Notes: + case PptViewTypeEnum::NotesMaster: + aVisAreaSize = aDocAtom.GetNotesPageSize(); + break; + default : + aVisAreaSize = aDocAtom.GetSlidesPageSize(); + } + Scale( aVisAreaSize ); + pDocShell->SetVisArea( ::tools::Rectangle( Point(), aVisAreaSize ) ); } - Scale( aVisAreaSize ); - pDocShell->SetVisArea( ::tools::Rectangle( Point(), aVisAreaSize ) ); // create master pages: @@ -1232,54 +1235,51 @@ bool ImplSdPPTImport::Import() pFrameView = new ::sd::FrameView( mpDoc ); rViews.push_back( std::unique_ptr<sd::FrameView>(pFrameView) ); } - if ( pFrameView ) - { - sal_uInt16 nSelectedPage = 0; - PageKind ePageKind = PageKind::Standard; - EditMode eEditMode = EditMode::Page; + sal_uInt16 nSelectedPage = 0; + PageKind ePageKind = PageKind::Standard; + EditMode eEditMode = EditMode::Page; - switch ( aUserEditAtom.eLastViewType ) + switch ( aUserEditAtom.eLastViewType ) + { + case PptViewTypeEnum::Outline: { - case PptViewTypeEnum::Outline: - { - SfxItemSet* pSet = mrMed.GetItemSet(); - if ( pSet ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) ); - } - break; - case PptViewTypeEnum::SlideSorter: - { - SfxItemSet* pSet = mrMed.GetItemSet(); - if ( pSet ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) ); - } - break; - case PptViewTypeEnum::TitleMaster: - nSelectedPage = 1; - SAL_FALLTHROUGH; - case PptViewTypeEnum::SlideMaster: - { - ePageKind = PageKind::Standard; - eEditMode = EditMode::MasterPage; - } - break; - case PptViewTypeEnum::NotesMaster: - eEditMode = EditMode::MasterPage; - SAL_FALLTHROUGH; - case PptViewTypeEnum::Notes: - ePageKind = PageKind::Notes; - break; - case PptViewTypeEnum::Handout: - ePageKind = PageKind::Handout; - break; - default : - case PptViewTypeEnum::Slide: - break; + SfxItemSet* pSet = mrMed.GetItemSet(); + if ( pSet ) + pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) ); + } + break; + case PptViewTypeEnum::SlideSorter: + { + SfxItemSet* pSet = mrMed.GetItemSet(); + if ( pSet ) + pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) ); + } + break; + case PptViewTypeEnum::TitleMaster: + nSelectedPage = 1; + SAL_FALLTHROUGH; + case PptViewTypeEnum::SlideMaster: + { + ePageKind = PageKind::Standard; + eEditMode = EditMode::MasterPage; } - pFrameView->SetPageKind( ePageKind ); - pFrameView->SetSelectedPage( nSelectedPage ); - pFrameView->SetViewShEditMode( eEditMode ); + break; + case PptViewTypeEnum::NotesMaster: + eEditMode = EditMode::MasterPage; + SAL_FALLTHROUGH; + case PptViewTypeEnum::Notes: + ePageKind = PageKind::Notes; + break; + case PptViewTypeEnum::Handout: + ePageKind = PageKind::Handout; + break; + default : + case PptViewTypeEnum::Slide: + break; } + pFrameView->SetPageKind( ePageKind ); + pFrameView->SetSelectedPage( nSelectedPage ); + pFrameView->SetViewShEditMode( eEditMode ); } DffRecordHeader aCustomShowHeader; // read and set custom show |