From 0855269035e17a1c4702d3cae85c98f46af66191 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 15 Sep 2003 06:00:00 +0000 Subject: [PATCH] fix crashing when doing a directional focus with no windows on the desktop --- openbox/focus.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/openbox/focus.c b/openbox/focus.c index 9c29345f..0f80a58b 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -280,8 +280,12 @@ void focus_cycle(gboolean forward, gboolean linear, goto done_cycle; } - if (!first) first = focus_client; - if (!focus_cycle_target) focus_cycle_target = focus_client; + if (!focus_order[screen_desktop]) + goto done_cycle; + + if (!first) first = focus_order[screen_desktop]->data; + if (!focus_cycle_target) focus_cycle_target = + focus_order[screen_desktop]->data; if (linear) list = client_list; else list = focus_order[screen_desktop]; @@ -352,8 +356,12 @@ void focus_directional_cycle(ObDirection dir, goto done_cycle; } - if (!first) first = focus_client; - if (!focus_cycle_target) focus_cycle_target = focus_client; + if (!focus_order[screen_desktop]) + goto done_cycle; + + if (!first) first = focus_order[screen_desktop]->data; + if (!focus_cycle_target) focus_cycle_target = + focus_order[screen_desktop]->data; if ((ft = client_find_directional(focus_cycle_target, dir))) { if (ft != focus_cycle_target) {/* prevents flicker */ -- 2.45.2