From 33cfdbe886144e8515593d96a80d850a7c6e382e Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Sun, 16 Apr 2023 19:40:39 +0200 Subject: xdg_shell: Fix crash if popup generates while toplevel is in the scratchpad --- sway/desktop/xdg_shell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sway') diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 8da922d5..9b6456da 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -67,7 +67,13 @@ static void popup_unconstrain(struct sway_xdg_popup *popup) { struct sway_view *view = popup->child.view; struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_popup; - struct sway_output *output = view->container->pending.workspace->output; + struct sway_workspace *workspace = view->container->pending.workspace; + if (!workspace) { + // is null if in the scratchpad + return; + } + + struct sway_output *output = workspace->output; // the output box expressed in the coordinate system of the toplevel parent // of the popup -- cgit v1.2.3