Skip to content

Commit 601c853

Browse files
committed
eel-gdk-pixbuf-extensions: Fix division by zero
Fixes Clang static analyzer warning: eel-gdk-pixbuf-extensions.c:403:29: warning: Division by zero *dest++ = r / n_pixels; ~~^~~~~~~~~~
1 parent 6e6c9c6 commit 601c853

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

eel/eel-gdk-pixbuf-extensions.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,18 @@ eel_gdk_pixbuf_scale_down (GdkPixbuf *pixbuf,
400400
}
401401
else
402402
{
403-
*dest++ = r / n_pixels;
404-
*dest++ = g / n_pixels;
405-
*dest++ = b / n_pixels;
403+
if (n_pixels != 0)
404+
{
405+
*dest++ = r / n_pixels;
406+
*dest++ = g / n_pixels;
407+
*dest++ = b / n_pixels;
408+
}
409+
else
410+
{
411+
*dest++ = 0;
412+
*dest++ = 0;
413+
*dest++ = 0;
414+
}
406415
}
407416

408417
s_x1 = s_x2;

0 commit comments

Comments
 (0)