summaryrefslogtreecommitdiff
path: root/gtk/gtkspinbutton.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-06-12 19:42:48 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-06-12 19:42:48 +0000
commitf51ef574b51d93eca5650fa37f55775b24b65ff1 (patch)
treebb552b9fa5ace59ea85b48cc0c0d403ecf1faa8b /gtk/gtkspinbutton.c
parenta98888390a7e081214bb159c8bf27b8166d2d143 (diff)
downloadgtk+-f51ef574b51d93eca5650fa37f55775b24b65ff1.tar.gz
Handle 0 increment, to fix division-by-zero problem. (#82816, George
Wed Jun 12 15:43:38 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkspinbutton.c (gtk_spin_button_snap): Handle 0 increment, to fix division-by-zero problem. (#82816, George Lebl.)
Diffstat (limited to 'gtk/gtkspinbutton.c')
-rw-r--r--gtk/gtkspinbutton.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 8642b271bf..7c7efc8720 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -1318,6 +1318,9 @@ gtk_spin_button_snap (GtkSpinButton *spin_button,
gdouble tmp;
inc = spin_button->adjustment->step_increment;
+ if (inc == 0)
+ return;
+
tmp = (val - spin_button->adjustment->lower) / inc;
if (tmp - floor (tmp) < ceil (tmp) - tmp)
val = spin_button->adjustment->lower + floor (tmp) * inc;