]> code.delx.au - spectrwm/commitdiff
Fix segfault when attempting to switch workspace during startup.
authorReginald Kennedy <rk@rejii.com>
Wed, 25 Mar 2015 16:46:53 +0000 (00:46 +0800)
committerReginald Kennedy <rk@rejii.com>
Wed, 25 Mar 2015 16:58:20 +0000 (00:58 +0800)
spectrwm.c

index ca7fe742615ad72932606e8f5de3955ed093bc96..48591d907e74fc31aa27b1d0b21f01740214a02a 100644 (file)
@@ -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