aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--types/wlr_xdg_foreign_v1.c7
-rw-r--r--types/wlr_xdg_foreign_v2.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/types/wlr_xdg_foreign_v1.c b/types/wlr_xdg_foreign_v1.c
index 49216e68..bb747517 100644
--- a/types/wlr_xdg_foreign_v1.c
+++ b/types/wlr_xdg_foreign_v1.c
@@ -33,7 +33,7 @@ static bool verify_is_toplevel(struct wl_resource *client_resource,
if (wlr_surface_is_xdg_surface(surface)) {
struct wlr_xdg_surface *xdg_surface =
wlr_xdg_surface_from_wlr_surface(surface);
- if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
+ if (xdg_surface == NULL || xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
wl_resource_post_error(client_resource, -1,
"surface must be an xdg_toplevel");
return false;
@@ -151,7 +151,10 @@ static void destroy_imported(struct wlr_xdg_imported_v1 *imported) {
wl_list_for_each_safe(child, child_tmp, &imported->children, link) {
struct wlr_xdg_surface *xdg_child =
wlr_xdg_surface_from_wlr_surface(child->surface);
- wlr_xdg_toplevel_set_parent(xdg_child, NULL);
+
+ if (xdg_child != NULL) {
+ wlr_xdg_toplevel_set_parent(xdg_child, NULL);
+ }
}
wl_list_remove(&imported->exported_destroyed.link);
diff --git a/types/wlr_xdg_foreign_v2.c b/types/wlr_xdg_foreign_v2.c
index c9ef5496..7f7bff06 100644
--- a/types/wlr_xdg_foreign_v2.c
+++ b/types/wlr_xdg_foreign_v2.c
@@ -42,7 +42,7 @@ static bool verify_is_toplevel(struct wl_resource *client_resource,
struct wlr_xdg_surface *xdg_surface =
wlr_xdg_surface_from_wlr_surface(surface);
- if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
+ if (xdg_surface == NULL || xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
wl_resource_post_error(client_resource,
ZXDG_EXPORTER_V2_ERROR_INVALID_SURFACE,
"surface must be an xdg_toplevel");
@@ -157,7 +157,10 @@ static void destroy_imported(struct wlr_xdg_imported_v2 *imported) {
wl_list_for_each_safe(child, child_tmp, &imported->children, link) {
struct wlr_xdg_surface *xdg_child =
wlr_xdg_surface_from_wlr_surface(child->surface);
- wlr_xdg_toplevel_set_parent(xdg_child, NULL);
+
+ if (xdg_child != NULL) {
+ wlr_xdg_toplevel_set_parent(xdg_child, NULL);
+ }
}
wl_list_remove(&imported->exported_destroyed.link);