From a817519c0daeb0784da8286eeebf825977115b65 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 29 Oct 2009 00:33:20 +0100 Subject: [PATCH] Bugfix: Prevent a division through zero (Thanks xeen) --- src/click.c | 5 +++++ 1 file changed, 5 insertions(+) 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 && -- 2.39.5