Kaydet (Commit) f075a3ad authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#735623 Division or modulo by float zero

Change-Id: Ibd53687416a4e20af7ac4a1e02c54407892aa470
üst 69b5df30
...@@ -552,12 +552,20 @@ void CalcDistances( const Polygon& rPoly, std::vector< double >& rDistances ) ...@@ -552,12 +552,20 @@ void CalcDistances( const Polygon& rPoly, std::vector< double >& rDistances )
void InsertMissingOutlinePoints( const Polygon& /*rOutlinePoly*/, const std::vector< double >& rDistances, const Rectangle& rTextAreaBoundRect, Polygon& rPoly ) void InsertMissingOutlinePoints( const Polygon& /*rOutlinePoly*/, const std::vector< double >& rDistances, const Rectangle& rTextAreaBoundRect, Polygon& rPoly )
{ {
sal_uInt16 i = 0; sal_uInt16 nSize = rPoly.GetSize();
if (nSize == 0)
return;
long nTextWidth = rTextAreaBoundRect.GetWidth();
if (nTextWidth == 0)
throw o3tl::divide_by_zero();
double fLastDistance = 0.0; double fLastDistance = 0.0;
for ( i = 0; i < rPoly.GetSize(); i++ ) for (sal_uInt16 i = 0; i < nSize; ++i)
{ {
Point& rPoint = rPoly[ i ]; Point& rPoint = rPoly[ i ];
double fDistance = (double)( rPoint.X() - rTextAreaBoundRect.Left() ) / (double)rTextAreaBoundRect.GetWidth(); double fDistance = (double)( rPoint.X() - rTextAreaBoundRect.Left() ) / (double)nTextWidth;
if ( i ) if ( i )
{ {
if ( fDistance > fLastDistance ) if ( fDistance > fLastDistance )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment