[gtk+] levelbar: fix a crash



commit 6322b1f647552d9da0d3524731b56b7a1a23c060
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jan 2 18:14:47 2016 -0800

    levelbar: fix a crash
    
    We should not try to access a block with an index that exceeds the
    number of blocks in the widget.

 gtk/gtklevelbar.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 45d9d4a..7259f85 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -712,6 +712,8 @@ update_level_style_classes (GtkLevelBar *self)
           num_blocks = (gint) round (priv->max_value) - (gint) round (priv->min_value);
         }
 
+      num_filled = MIN (num_blocks, num_filled);
+
       classes[0] = "filled";
       classes[1] = value_class;
       for (i = 0; i < num_filled; i++)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]