aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2021-03-20 12:56:40 +0100
committerFurkan Sahin <furkan-dev@proton.me>2021-03-20 12:56:40 +0100
commit3f7386128b537dbd71993b0f3a563f8b49f22fb4 (patch)
tree22b40af20b271d81a574a71d57b5a505267ca752
parent4927dc44be28cb1b1d5a1c9d75137b1ee1bc441d (diff)
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.
-rw-r--r--sway/tree/view.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 8a2a8178..395b9fac 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -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