Fixed crash on Close action with no view open

This commit is contained in:
Keith Bowes 2022-02-18 19:39:46 -05:00
parent 141a941bed
commit 94e23a28f3

View file

@ -72,7 +72,8 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
{
struct wb_view *current_view = wl_container_of(
server->views.next, current_view, link);
wlr_xdg_toplevel_send_close(current_view->xdg_toplevel);
if (wlr_surface_is_xdg_surface(current_view->xdg_toplevel->base->surface))
wlr_xdg_toplevel_send_close(current_view->xdg_toplevel);
return true;
}
case ACTION_EXECUTE:
@ -87,6 +88,8 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
case ACTION_EXIT:
wl_display_terminate(server->wl_display);
return true;
default:
continue;
}
}
}