From 42e125348ad95be3a672718b780c9082eeb226c5 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 23 Oct 2021 19:46:13 -0700 Subject: 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. --- src/window.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3