levelbar: Don't allocate 0 blocks

Could result in a division by zero later on and doesn't make a lot of
sense anyway.
This commit is contained in:
Timm Bäder 2017-04-30 20:19:56 +02:00 committed by Daniel Boles
parent 46decc6182
commit 3380cd63c1

View 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));