add an assert to detect possible division by zero

issue found by coverity
This commit is contained in:
Chris Beck 2014-11-17 14:35:20 -05:00
parent 9f69a5196e
commit 968d8a900d

View file

@ -1689,6 +1689,7 @@ surface blur_alpha_surface(const surface &surf, int depth, bool optimize)
p = lock.pixels() + x;
for(y = 0; y < res->h; ++y, p += res->w) {
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(y >= depth) {
alpha -= ((*front) >> 24)&0xFF;