From: Michael Stapelberg Date: Wed, 28 Oct 2009 23:33:20 +0000 (+0100) Subject: Bugfix: Prevent a division through zero (Thanks xeen) X-Git-Tag: 3.d~30 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a817519c0daeb0784da8286eeebf825977115b65;p=i3%2Fi3 Bugfix: Prevent a division through zero (Thanks xeen) --- diff --git a/src/click.c b/src/click.c index b3a00afa..28737f3b 100644 --- a/src/click.c +++ b/src/click.c @@ -84,6 +84,11 @@ static bool button_press_stackwin(xcb_connection_t *conn, xcb_button_press_event CIRCLEQ_FOREACH(client, &(container->clients), clients) num_clients++; + /* If we don’t have any clients in this container, we cannot do + * anything useful anyways. */ + if (num_clients == 0) + return; + if (container->mode == MODE_TABBED) destination = (event->event_x / (container->width / num_clients)); else if (container->mode == MODE_STACK &&