summaryrefslogtreecommitdiffstats
path: root/src/ui/previewholder.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-01-17 12:07:23 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-01-17 12:07:23 +0000
commitc8e9032a0518391df1f62ba1aa26fd4d39fd51e4 (patch)
treeb8f03305ef4c3860e3fb0c0bda964e5e45d3bff1 /src/ui/previewholder.cpp
parentpanel: Cleanup code (diff)
downloadinkscape-c8e9032a0518391df1f62ba1aa26fd4d39fd51e4.tar.gz
inkscape-c8e9032a0518391df1f62ba1aa26fd4d39fd51e4.zip
Fix possible divide by zero.
Diffstat (limited to 'src/ui/previewholder.cpp')
-rw-r--r--src/ui/previewholder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 789156aa5..a7d2c97ff 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -313,12 +313,13 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* item, int itemCount, int& n
natural_width_item = 1;
}
ncols = width_scroller / natural_width_item - 1;
- nrows = itemCount / ncols;
// On first run, scroller width is not set correct... so we need to fudge it:
if (ncols < 2) {
ncols = itemCount/2;
nrows = 2;
+ } else {
+ nrows = itemCount / ncols;
}
}
} else {