summaryrefslogtreecommitdiff
path: root/sw/source/ui/vba
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-12 11:15:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-12 15:23:29 +0100
commit0b36794425a559355362911ec79a3bd04d5598dd (patch)
tree20fecd6cc28c8e374d30f55616028fa5f2308473 /sw/source/ui/vba
parent7e88182f673900f214b855f1c9563e63ba43eaca (diff)
coverity#735985 Unchecked dynamic_cast
Change-Id: I1bb293567cf6e6437d1ac1f257b25d7de1d0ac75
Diffstat (limited to 'sw/source/ui/vba')
-rw-r--r--sw/source/ui/vba/vbalistformat.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/ui/vba/vbalistformat.cxx b/sw/source/ui/vba/vbalistformat.cxx
index 9740758e3a92..78a498b14255 100644
--- a/sw/source/ui/vba/vbalistformat.cxx
+++ b/sw/source/ui/vba/vbalistformat.cxx
@@ -57,12 +57,15 @@ void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< wor
if( nDefaultListBehavior != word::WdDefaultListBehavior::wdWord8ListBehavior )
throw uno::RuntimeException();
- SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
-
uno::Reference< container::XEnumerationAccess > xEnumAccess( mxTextRange, uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
+ if (!xEnum->hasMoreElements())
+ return;
+
+ SwVbaListTemplate& rListTemplate = dynamic_cast<SwVbaListTemplate&>(*ListTemplate.get());
+
bool isFirstElement = true;
- while( xEnum->hasMoreElements() )
+ do
{
uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
if( isFirstElement )
@@ -80,8 +83,9 @@ void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< wor
{
xProps->setPropertyValue("ParaIsNumberingRestart", uno::makeAny( sal_False ) );
}
- pListTemplate->applyListTemplate( xProps );
+ rListTemplate.applyListTemplate( xProps );
}
+ while( xEnum->hasMoreElements() );
}
void SAL_CALL SwVbaListFormat::ConvertNumbersToText( ) throw (css::uno::RuntimeException, std::exception)