[gtk+] levelbar: Don't allocate 0 blocks
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] levelbar: Don't allocate 0 blocks
- Date: Sun, 30 Apr 2017 19:14:44 +0000 (UTC)
commit 6ae0aef84053cd6f231f8cfea5985de44542467c
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 d1b25b3..6cc32e4 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -480,6 +480,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]