From 9b6d0e3011ca48cf0ae92c8d6036ae2ff9588ab7 Mon Sep 17 00:00:00 2001 From: garbeam Date: Tue, 13 Dec 2005 21:06:07 +0200 Subject: [PATCH] made col layout more robust to actions --- cmd/wm/layout_column.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c index 7519c9c6..1451feca 100644 --- a/cmd/wm/layout_column.c +++ b/cmd/wm/layout_column.c @@ -349,6 +349,9 @@ static void select_frame(void *obj, char *arg) Column *col = get_sel_column(acme); Frame *f, *old; + if (!col) + return; + f = old = cext_stack_get_top_item(&col->frames); if (!f || !arg) return; @@ -380,11 +383,16 @@ static void swap_frame(void *obj, char *arg) Area *a = obj; Acme *acme = a->aux; Column *west = 0, *east = 0, *col = get_sel_column(acme); - Frame *north = 0, *south = 0, *f = cext_stack_get_top_item(&col->frames); + Frame *north = 0, *south = 0, *f; XRectangle r; size_t ncol, nfr; int colidx, fidx; + if (!col) + return; + + f = cext_stack_get_top_item(&col->frames); + if (!f || !arg) return; @@ -458,11 +466,12 @@ static void new_col(void *obj, char *arg) Area *a = obj; Acme *acme = a->aux; Column *col = get_sel_column(acme); - Frame *f = cext_stack_get_top_item(&col->frames); + Frame *f; - if (cext_sizeof_container(&col->frames) < 2) + if (!col || (cext_sizeof_container(&col->frames) < 2)) return; + f = cext_stack_get_top_item(&col->frames); cext_detach_item(&col->frames, f); f->aux = col = cext_emallocz(sizeof(Column)); cext_attach_item(&col->frames, f);