summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-03 02:54:35 +0100
committerZenWalker <[email protected]>2019-03-06 23:54:30 +0100
commitb26eff1f5c823c6eafbc24bb4552c071c41f34b7 (patch)
treeaf4fd5f838d51a656309984eda91affca450b114 /eel
parent726144259f649e80ae1221e065ee8d9706b86616 (diff)
downloadcaja-b26eff1f5c823c6eafbc24bb4552c071c41f34b7.tar.bz2
caja-b26eff1f5c823c6eafbc24bb4552c071c41f34b7.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.c15
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;