[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Thu Jun 12 07:23:57 PDT 2014
sw/source/ui/vba/vbalistformat.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 0b36794425a559355362911ec79a3bd04d5598dd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 12 11:15:55 2014 +0100
coverity#735985 Unchecked dynamic_cast
Change-Id: I1bb293567cf6e6437d1ac1f257b25d7de1d0ac75
diff --git a/sw/source/ui/vba/vbalistformat.cxx b/sw/source/ui/vba/vbalistformat.cxx
index 9740758..78a498b 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)
More information about the Libreoffice-commits
mailing list