diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-10-23 19:46:13 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-10-23 19:46:13 -0700 |
commit | 42e125348ad95be3a672718b780c9082eeb226c5 (patch) | |
tree | f4b22e1e058435fbdea9651ccc43d0023c6e0bd6 | |
parent | 0f8807884e316f60e7828c53a43ee6bd18f7348b (diff) |
window: don't crash in assimilate unexpected case
the non-empty focused_desktop having NULL focused_window shouldn't
be possible, but it just happened to me again while playing with
eon's WIP windowed/fullscreen/fillscreen tristate branch.
Though exceedingly rare, it's annoying, so log the bug and don't crash.
-rw-r--r-- | src/window.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c index 5410ba6..2620372 100644 --- a/src/window.c +++ b/src/window.c @@ -464,7 +464,10 @@ static void vwm_win_assimilate(vwm_t *vwm, vwm_window_t *vwin) /* FIXME TODO: there's some situation where we get here but focused_desktop->focused_window == NULL, * which shouldn't be possible; for there to be a non-empty screen, the focused_desktop must have a focused_window. */ - scr = vwm_screen_find(vwm, VWM_SCREEN_REL_XWIN, vwm->focused_desktop->focused_window->xwindow); + if (vwm->focused_desktop->focused_window) + scr = vwm_screen_find(vwm, VWM_SCREEN_REL_XWIN, vwm->focused_desktop->focused_window->xwindow); + else + VWM_BUG("Screen is not empty, but vwm->focused_desktop->focused_window is NULL!"); } changes.x = scr->x_org; |