diff options
author | Pablo Barciela <[email protected]> | 2019-03-03 02:54:35 +0100 |
---|---|---|
committer | Pablo Barciela <[email protected]> | 2019-03-06 23:57:45 +0100 |
commit | 601c8533a5430055df7af0c723387888ff014c3a (patch) | |
tree | 4691d37456967944e96bf0a9db9dcb88e4a2964d /eel | |
parent | 6e6c9c6b456718ba76ecbd2d956f718374ffd3cd (diff) | |
download | caja-601c8533a5430055df7af0c723387888ff014c3a.tar.bz2 caja-601c8533a5430055df7af0c723387888ff014c3a.tar.xz |
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;
~~^~~~~~~~~~
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-gdk-pixbuf-extensions.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/eel/eel-gdk-pixbuf-extensions.c b/eel/eel-gdk-pixbuf-extensions.c index 646a5734..b74b1062 100644 --- a/eel/eel-gdk-pixbuf-extensions.c +++ b/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; |