From 6560cae1b5f81cb753a7216cb22d4e7f9d175cd1 Mon Sep 17 00:00:00 2001 From: Yong Lin Ma Date: Sat, 16 Jun 2012 06:47:30 +0000 Subject: 118878: Writer crash after column number and width of frame are modified Patch by: Lin Yuan Review by: mayongl Reported by: Ji Yan --- sw/source/core/layout/colfrm.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index 654657a26f62..f8522c17107f 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -349,7 +349,7 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut const sal_Bool bOrtho = pAttr->IsOrtho() && pAttr->GetNumCols() > 0; long nGutter = 0; - for ( sal_uInt16 i = 0; i < pAttr->GetNumCols(); ++i ) + for ( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; ++i ) //i118878, value returned by GetNumCols() can't be trusted { if( !bOrtho ) { @@ -426,7 +426,7 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut { long nInnerWidth = ( nAvail - nGutter ) / pAttr->GetNumCols(); pCol = Lower(); - for( sal_uInt16 i = 0; i < pAttr->GetNumCols(); pCol = pCol->GetNext(), ++i ) + for( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; pCol = pCol->GetNext(), ++i ) //i118878, value returned by GetNumCols() can't be trusted { SwTwips nWidth; if ( i == pAttr->GetNumCols() - 1 ) -- cgit