1
1
Fork 0
mirror of https://github.com/swaywm/sway synced 2024-05-04 06:46:05 +02:00

view: Handle NULL role object when role is set

wlr_(xdg|xwayland)_surface_from_wlr_surface can return NULL even though
wlr_surface_is_(xdg|xwayland)_surface returned true.
This commit is contained in:
Kenny Levinsen 2021-03-20 12:56:40 +01:00 committed by Simon Ser
parent 3287b12fff
commit 70842f4e14

View File

@ -1139,12 +1139,18 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
if (wlr_surface_is_xdg_surface(wlr_surface)) {
struct wlr_xdg_surface *xdg_surface =
wlr_xdg_surface_from_wlr_surface(wlr_surface);
if (xdg_surface == NULL) {
return NULL;
}
return view_from_wlr_xdg_surface(xdg_surface);
}
#if HAVE_XWAYLAND
if (wlr_surface_is_xwayland_surface(wlr_surface)) {
struct wlr_xwayland_surface *xsurface =
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
if (xsurface == NULL) {
return NULL;
}
return view_from_wlr_xwayland_surface(xsurface);
}
#endif