Kaydet (Commit) c0cb909b authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#735763 Unchecked dynamic_cast

Change-Id: I4b8a0ebc846ee91530d28821643b3d2f98c0d4f2
üst 1e022fda
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment