diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-02 12:11:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-02 20:08:16 +0000 |
commit | 7edf847bf77ce9f6300063168cc9aea316393480 (patch) | |
tree | 42b49dcc17a33568e1562f945e0e21c9ce7d37c2 /filter/source/msfilter/msdffimp.cxx | |
parent | 0f48aba07adee6253c4abd31329f11d485e38139 (diff) |
coverity#704638 Dereference after null check
Change-Id: Ib5e8996d8eb9e487b1c961aa2137b859c887eb6a
Diffstat (limited to 'filter/source/msfilter/msdffimp.cxx')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 91 |
1 files changed, 47 insertions, 44 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index f87c8e3b6495..679388c8c452 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -507,62 +507,65 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) case OBJ_PATHPOLY : case OBJ_PATHPLIN : { - if ( pList && ( pList->GetCount() > nC ) ) + if (pList) { - bValidGluePoint = sal_True; - nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 ); - } - else - { - sal_Bool bNotFound = sal_True; - - PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aXShape ) ); - sal_uInt16 k, j, nPolySize = aPolyPoly.Count(); - if ( nPolySize ) + if (pList->GetCount() > nC ) + { + bValidGluePoint = sal_True; + nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 ); + } + else { - Rectangle aBoundRect( aPolyPoly.GetBoundRect() ); - if ( aBoundRect.GetWidth() && aBoundRect.GetHeight() ) + sal_Bool bNotFound = sal_True; + + PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aXShape ) ); + sal_uInt16 k, j, nPolySize = aPolyPoly.Count(); + if ( nPolySize ) { - sal_uInt32 nPointCount = 0; - for ( k = 0; bNotFound && ( k < nPolySize ); k++ ) + Rectangle aBoundRect( aPolyPoly.GetBoundRect() ); + if ( aBoundRect.GetWidth() && aBoundRect.GetHeight() ) { - const Polygon& rPolygon = aPolyPoly.GetObject( k ); - for ( j = 0; bNotFound && ( j < rPolygon.GetSize() ); j++ ) + sal_uInt32 nPointCount = 0; + for ( k = 0; bNotFound && ( k < nPolySize ); k++ ) { - PolyFlags eFlags = rPolygon.GetFlags( j ); - if ( eFlags == POLY_NORMAL ) + const Polygon& rPolygon = aPolyPoly.GetObject( k ); + for ( j = 0; bNotFound && ( j < rPolygon.GetSize() ); j++ ) { - if ( nC == nPointCount ) + PolyFlags eFlags = rPolygon.GetFlags( j ); + if ( eFlags == POLY_NORMAL ) { - const Point& rPoint = rPolygon.GetPoint( j ); - double fXRel = rPoint.X() - aBoundRect.Left(); - double fYRel = rPoint.Y() - aBoundRect.Top(); - sal_Int32 nWidth = aBoundRect.GetWidth(); - if ( !nWidth ) - nWidth = 1; - sal_Int32 nHeight= aBoundRect.GetHeight(); - if ( !nHeight ) - nHeight = 1; - fXRel /= (double)nWidth; - fXRel *= 10000; - fYRel /= (double)nHeight; - fYRel *= 10000; - aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) ); - aGluePoint.SetPercent( true ); - aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT ); - aGluePoint.SetEscDir( SDRESC_SMART ); - nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 ); - bNotFound = sal_False; + if ( nC == nPointCount ) + { + const Point& rPoint = rPolygon.GetPoint( j ); + double fXRel = rPoint.X() - aBoundRect.Left(); + double fYRel = rPoint.Y() - aBoundRect.Top(); + sal_Int32 nWidth = aBoundRect.GetWidth(); + if ( !nWidth ) + nWidth = 1; + sal_Int32 nHeight= aBoundRect.GetHeight(); + if ( !nHeight ) + nHeight = 1; + fXRel /= (double)nWidth; + fXRel *= 10000; + fYRel /= (double)nHeight; + fYRel *= 10000; + aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) ); + aGluePoint.SetPercent( true ); + aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT ); + aGluePoint.SetEscDir( SDRESC_SMART ); + nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 ); + bNotFound = sal_False; + } + nPointCount++; } - nPointCount++; } } } } - } - if ( !bNotFound ) - { - bValidGluePoint = sal_True; + if ( !bNotFound ) + { + bValidGluePoint = sal_True; + } } } } |