From 05be57f6871996cc5b03e11fc06d2d2baeebae09 Mon Sep 17 00:00:00 2001 From: Reginald Kennedy Date: Thu, 26 Mar 2015 00:46:53 +0800 Subject: [PATCH] Fix segfault when attempting to switch workspace during startup. --- spectrwm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 -- 2.39.2