diff --git a/plugins/protocols/foreign-toplevel.cpp b/plugins/protocols/foreign-toplevel.cpp index d0a912363..96b5a2bb3 100644 --- a/plugins/protocols/foreign-toplevel.cpp +++ b/plugins/protocols/foreign-toplevel.cpp @@ -85,10 +85,14 @@ class wayfire_foreign_toplevel } else if (app_id_mode == "full") { #if WF_HAS_XWAYLAND - if (wlr_xwayland_surface *xw_surface = - wlr_xwayland_surface_try_from_wlr_surface(view->get_wlr_surface())) + auto wlr_surface = view->get_wlr_surface(); + if (wlr_surface) { - ev.app_id = nonull(xw_surface->instance); + if (wlr_xwayland_surface *xw_surface = + wlr_xwayland_surface_try_from_wlr_surface(wlr_surface)) + { + ev.app_id = nonull(xw_surface->instance); + } } #endif