From: Reginald Kennedy Date: Wed, 25 Mar 2015 16:46:53 +0000 (+0800) Subject: Fix segfault when attempting to switch workspace during startup. X-Git-Tag: SPECTRWM_2_7_0~15 X-Git-Url: https://code.delx.au/spectrwm/commitdiff_plain/05be57f6871996cc5b03e11fc06d2d2baeebae09 Fix segfault when attempting to switch workspace during startup. --- diff --git a/spectrwm.c b/spectrwm.c index ca7fe74..48591d9 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -5858,10 +5858,13 @@ ewmh_update_current_desktop(void) int num_screens, i; num_screens = get_screen_count(); - for (i = 0; i < num_screens; ++i) - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, - screens[i].root, ewmh[_NET_CURRENT_DESKTOP].atom, - XCB_ATOM_CARDINAL, 32, 1, &screens[i].r_focus->ws->idx); + for (i = 0; i < num_screens; ++i) { + if (screens[i].r_focus) + xcb_change_property(conn, XCB_PROP_MODE_REPLACE, + screens[i].root, ewmh[_NET_CURRENT_DESKTOP].atom, + XCB_ATOM_CARDINAL, 32, 1, + &screens[i].r_focus->ws->idx); + } } void