[gtk+/gtk-3-22] levelbar: Don't allocate 0 blocks
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] levelbar: Don't allocate 0 blocks
- Date: Mon, 22 May 2017 13:31:02 +0000 (UTC)
commit 3380cd63c17ea5cf4b279c5c7a334e5b6da4e1e8
Author: Timm Bäder <mail baedert org>
Date: Sun Apr 30 20:19:56 2017 +0200
levelbar: Don't allocate 0 blocks
Could result in a division by zero later on and doesn't make a lot of
sense anyway.
gtk/gtklevelbar.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 0e2623f..7fc1279 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -508,6 +508,9 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
gtk_level_bar_get_min_block_size (self, &block_width, &block_height);
num_blocks = gtk_level_bar_get_num_blocks (self);
+ if (num_blocks == 0)
+ return;
+
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
block_width = MAX (block_width, (gint) floor (allocation->width / num_blocks));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]