summaryrefslogtreecommitdiff
path: root/gtk/gtklevelbar.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2016-01-02 18:14:47 -0800
committerCosimo Cecchi <cosimoc@gnome.org>2016-01-02 18:44:07 -0800
commit6322b1f647552d9da0d3524731b56b7a1a23c060 (patch)
tree6ec46902f2ba593b2513b8ccf312f49b72750ca2 /gtk/gtklevelbar.c
parent8109520d4efda502b0141fa0e8482679fbb12fa7 (diff)
downloadgtk+-6322b1f647552d9da0d3524731b56b7a1a23c060.tar.gz
levelbar: fix a crash
We should not try to access a block with an index that exceeds the number of blocks in the widget.
Diffstat (limited to 'gtk/gtklevelbar.c')
-rw-r--r--gtk/gtklevelbar.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 45d9d4a0c6..7259f85de5 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++)