levelbar: Don't allocate 0 blocks
authorTimm Bäder <mail@baedert.org>
Sun, 30 Apr 2017 18:19:56 +0000 (20:19 +0200)
committerDaniel Boles <dboles.src@gmail.com>
Mon, 22 May 2017 13:26:31 +0000 (14:26 +0100)
Could result in a division by zero later on and doesn't make a lot of
sense anyway.

gtk/gtklevelbar.c

index 0e2623f7ff475133034c606777edaa618cf58d00..7fc12794c45767b1f7f3f50fbc153a8275579219 100644 (file)
@@ -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));