From 6d7dc74b382664ff8bc4c8790ec9febcb34716f4 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Mon, 22 Apr 2013 11:45:34 +0200 Subject: n#382137: Do run out of bounds (& consequently crash) when we have 0 spans. Maybe just works around the root issue (I did not debug deeper if this is correct to have 0 here), but improves the code overall, so why not to do this. Change-Id: I7c2b7f7e410faea5c1d6f3c15f1bc0f155dfb1f4 --- writerfilter/source/dmapper/DomainMapperTableManager.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index bbdb53d4f017..e10a3b6cc858 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -551,12 +551,9 @@ void DomainMapperTableManager::endOfRowAction() ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( ); for( sal_uInt32 nBorder = 0; nBorder < m_nCell.back( ) - 1; ++nBorder ) { - sal_Int32 nGridCount = *aSpansIter; double fGridWidth = 0.; - do - { + for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount ) fGridWidth += (*pTableGrid.get())[nBorderGridIndex++]; - }while( --nGridCount ); sal_Int16 nRelPos = sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative); -- cgit