guard psurface in activateSurface

This commit is contained in:
vaxerski 2022-08-31 11:12:46 +02:00
parent 1cf46fd6a2
commit 7f483dfdb0

View file

@ -32,9 +32,12 @@ wlr_surface* CHyprXWaylandManager::getWindowSurface(CWindow* pWindow) {
} }
void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate) { void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate) {
if (!pSurface)
return;
if (wlr_surface_is_xdg_surface(pSurface)) { if (wlr_surface_is_xdg_surface(pSurface)) {
const auto PSURF = wlr_xdg_surface_from_wlr_surface(pSurface); const auto PSURF = wlr_xdg_surface_from_wlr_surface(pSurface);
if (PSURF->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { if (PSURF && PSURF->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
wlr_xdg_toplevel_set_activated(PSURF->toplevel, activate); wlr_xdg_toplevel_set_activated(PSURF->toplevel, activate);
} }
} else if (wlr_surface_is_xwayland_surface(pSurface)) { } else if (wlr_surface_is_xwayland_surface(pSurface)) {