From 9402724e4022e84e2e9aa262df8dd882fb8f8835 Mon Sep 17 00:00:00 2001 From: kojima Date: Fri, 15 Oct 2004 01:00:36 +0000 Subject: [PATCH] fixed crash in empty workspaces --- src/switchpanel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/switchpanel.c b/src/switchpanel.c index c12e1c9e..83ce014d 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -247,8 +247,13 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace) iconWidth = width / WMGetArrayItemCount(panel->windows) - ICON_EXTRASPACE; } - if (iconWidth < 16 || WMGetArrayItemCount(panel->windows) == 0) - { + if (WMGetArrayItemCount(panel->windows) == 0) { + WMFreeArray(panel->windows); + wfree(panel); + return NULL; + } + + if (iconWidth < 16) { /* if there are too many windows, don't bother trying to show the panel */ return panel;