[gtk+/wip/baedert/drawing: 13/22] range: Avoid division by zero
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 13/22] range: Avoid division by zero
- Date: Sat, 1 Jul 2017 14:57:14 +0000 (UTC)
commit e58680ccaa7fe9a4f92fdb592357631b22b10c3f
Author: Timm Bäder <mail baedert org>
Date: Thu Jun 29 15:28:24 2017 +0200
range: Avoid division by zero
gtk/gtkrange.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index f74f1b2..2c4d208 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1425,8 +1425,11 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
gtk_widget_size_allocate (priv->slider_widget, &slider_alloc);
gtk_widget_get_clip (priv->slider_widget, out_clip);
- value = (gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment)) /
- (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment));
+ if (gtk_adjustment_get_lower (priv->adjustment) == gtk_adjustment_get_upper (priv->adjustment))
+ value = 0;
+ else
+ value = (gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment)) /
+ (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment));
if (priv->show_fill_level &&
gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) -
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]