Skip to content
Permalink
Browse files

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;
                          ~~^~~~~~~~~~
  • Loading branch information...
sc0w committed Mar 3, 2019
1 parent 6e6c9c6 commit 601c8533a5430055df7af0c723387888ff014c3a
Showing with 12 additions and 3 deletions.
  1. +12 −3 eel/eel-gdk-pixbuf-extensions.c
@@ -400,9 +400,18 @@ eel_gdk_pixbuf_scale_down (GdkPixbuf *pixbuf,
}
else
{
*dest++ = r / n_pixels;
*dest++ = g / n_pixels;
*dest++ = b / n_pixels;
if (n_pixels != 0)
{
*dest++ = r / n_pixels;
*dest++ = g / n_pixels;
*dest++ = b / n_pixels;
}
else
{
*dest++ = 0;
*dest++ = 0;
*dest++ = 0;
}
}

s_x1 = s_x2;

0 comments on commit 601c853

Please sign in to comment.
You can’t perform that action at this time.