coverity#1222230 Division or modulo by zero

Change-Id: I98ccd214be79f3d95c023fd5134d09c1cff3ee32
This commit is contained in:
Caolán McNamara 2014-06-10 13:44:54 +01:00
parent c7661d5af5
commit f658532d2c

View File

@ -378,9 +378,14 @@ void scalePallete8bit2(BitmapReadAccess* pAcc, BitmapWriteAccess* pWAcc,
nTotalWeightY += nWeightY;
}
BitmapColor aColRes ( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ),
( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
( sal_uInt8 ) (( nSumB / nTotalWeightY) ) );
if (nTotalWeightY)
{
nSumR /= nTotalWeightY;
nSumG /= nTotalWeightY;
nSumB /= nTotalWeightY;
}
BitmapColor aColRes((sal_uInt8)nSumR, (sal_uInt8)nSumG, (sal_uInt8)nSumB);
pWAcc->SetPixel( nYDst, nXDst++, aColRes );
}
}