diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-12 13:31:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-12 13:54:16 +0100 |
commit | c0cb909ba7f01e3d644e8555289be3ab0785d15d (patch) | |
tree | bebebb508a7d09af2b08adc307b8066d36ad2231 /oox/source | |
parent | 1e022fda62d93421c0de064e3422f9d695409e1e (diff) |
coverity#735763 Unchecked dynamic_cast
Change-Id: I4b8a0ebc846ee91530d28821643b3d2f98c0d4f2
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 0c5ebe0b74c4..a2dd7288219c 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -400,6 +400,15 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace return aShapePtr; } +namespace +{ + bool ShapeLocationIsMaster(oox::drawingml::Shape *pInShape) + { + PPTShape* pShape = dynamic_cast<PPTShape*>(pInShape); + return pShape && pShape->getShapeLocation() == Master; + } +} + oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly ) { oox::drawingml::ShapePtr aShapePtr; @@ -408,8 +417,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, while( aRevIter != rShapes.rend() ) { if ( (*aRevIter)->getSubTypeIndex().has() && (*aRevIter)->getSubTypeIndex().get() == nIdx && - ( !bMasterOnly || - ( dynamic_cast< PPTShape* >( (*aRevIter).get() ) && dynamic_cast< PPTShape* >( (*aRevIter).get() )->getShapeLocation() == Master ) ) ) + ( !bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()) ) ) { aShapePtr = *aRevIter; break; |