coverity#1222233 Division or modulo by zero

Change-Id: I699dc60b67d9417a8ac3848c03d7352f9f8ff12d
This commit is contained in:
Caolán McNamara
2014-06-10 13:40:50 +01:00
parent b311aab85f
commit aaaf24322e

View File

@@ -861,9 +861,16 @@ void scaleNonPalleteGeneral2(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;
}