coverity#1222229 Division or modulo by zero

Change-Id: I97fd23d19a96665b91154ed260c677f0f76fee47
This commit is contained in:
Caolán McNamara
2014-06-10 13:46:25 +01:00
parent f658532d2c
commit 434546a28d

View File

@@ -372,9 +372,16 @@ void scalePallete8bit2(BitmapReadAccess* pAcc, BitmapWriteAccess* pWAcc,
else if ( nLineRange == i )
nWeightY = pMapFY[ nBottom ];
nSumB += nWeightY * ( nSumRowB / nTotalWeightX );
nSumG += nWeightY * ( nSumRowG / nTotalWeightX );
nSumR += nWeightY * ( nSumRowR / nTotalWeightX );
if (nTotalWeightX)
{
nSumRowB /= nTotalWeightX;
nSumRowG /= nTotalWeightX;
nSumRowR /= nTotalWeightX;
}
nSumB += nWeightY * nSumRowB;
nSumG += nWeightY * nSumRowG;
nSumR += nWeightY * nSumRowR;
nTotalWeightY += nWeightY;
}