Bugfix: Prevent a division through zero (Thanks xeen)

This commit is contained in:
Michael Stapelberg 2009-10-29 00:33:20 +01:00
parent 16d33ec9df
commit a817519c0d
1 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,11 @@ static bool button_press_stackwin(xcb_connection_t *conn, xcb_button_press_event
CIRCLEQ_FOREACH(client, &(container->clients), clients) CIRCLEQ_FOREACH(client, &(container->clients), clients)
num_clients++; num_clients++;
/* If we dont have any clients in this container, we cannot do
* anything useful anyways. */
if (num_clients == 0)
return;
if (container->mode == MODE_TABBED) if (container->mode == MODE_TABBED)
destination = (event->event_x / (container->width / num_clients)); destination = (event->event_x / (container->width / num_clients));
else if (container->mode == MODE_STACK && else if (container->mode == MODE_STACK &&