From: Dana Jansens Date: Mon, 15 Sep 2003 06:00:00 +0000 (+0000) Subject: fix crashing when doing a directional focus with no windows on the desktop X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=0855269035e17a1c4702d3cae85c98f46af66191;p=chaz%2Fopenbox fix crashing when doing a directional focus with no windows on the desktop --- 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 */