[Xfce4-commits] [xfce/xfdesktop] 01/01: Don't try to divide by 0 (Bug #12115)
noreply at xfce.org
noreply at xfce.org
Mon Aug 10 16:36:56 CEST 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfdesktop.
commit 25124215bf78ce2c66491700ccb9e43525980cd2
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Mon Aug 10 17:33:35 2015 +0300
Don't try to divide by 0 (Bug #12115)
---
src/xfdesktop-icon-view.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 81ef3a1..c598171 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -2715,11 +2715,22 @@ xfdesktop_setup_grids(XfdesktopIconView *icon_view)
icon_view->priv->ncols = (width - MIN_MARGIN * 2) / CELL_SIZE;
xrest = icon_view->priv->width - icon_view->priv->ncols * CELL_SIZE;
- icon_view->priv->xspacing = (xrest - MIN_MARGIN * 2) / (icon_view->priv->ncols - 1);
+ if (icon_view->priv->ncols > 1) {
+ icon_view->priv->xspacing = (xrest - MIN_MARGIN * 2) / (icon_view->priv->ncols - 1);
+ } else {
+ /* Let's not try to divide by 0 */
+ icon_view->priv->xspacing = 1;
+ }
+
icon_view->priv->xmargin = (xrest - (icon_view->priv->ncols - 1) * icon_view->priv->xspacing) / 2;
yrest = icon_view->priv->height - icon_view->priv->nrows * CELL_SIZE;
- icon_view->priv->yspacing = (yrest - MIN_MARGIN * 2) / (icon_view->priv->nrows - 1);
+ if (icon_view->priv->nrows > 1) {
+ icon_view->priv->yspacing = (yrest - MIN_MARGIN * 2) / (icon_view->priv->nrows - 1);
+ } else {
+ /* Let's not try to divide by 0 */
+ icon_view->priv->yspacing = 1;
+ }
icon_view->priv->ymargin = (yrest - (icon_view->priv->nrows - 1) * icon_view->priv->yspacing) / 2;
new_size = (guint)icon_view->priv->nrows * icon_view->priv->ncols
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list