Quell divide-by-zero warning

Coverity has been noting that `avg` might be zero when dividing. This is impossible.

Use assert() to quell the Coverity warning.

Closes CID 13801515
This commit is contained in:
Gregory A Lundberg 2017-10-31 19:51:31 -05:00
parent fa14cf65e1
commit 07b04775ff

View file

@ -1628,6 +1628,7 @@ surface blur_alpha_surface(const surface &surf, int depth)
p = lock.pixels() + y*res->w;
for(x = 0; x < res->w; ++x, ++p) {
assert(avg);
*p = (std::min(alpha/avg,ff) << 24) | (std::min(red/avg,ff) << 16) | (std::min(green/avg,ff) << 8) | std::min(blue/avg,ff);
if(x >= depth) {
alpha -= ((*front) >> 24)&0xFF;