diff --git a/seat.c b/seat.c index b0d6ea1..4dce511 100644 --- a/seat.c +++ b/seat.c @@ -817,6 +817,9 @@ struct cg_view * seat_get_focus(struct cg_seat *seat) { struct wlr_surface *prev_surface = seat->seat->keyboard_state.focused_surface; + if (!prev_surface) { + return NULL; + } return view_from_wlr_surface(prev_surface); } diff --git a/view.c b/view.c index 8c064a9..6551142 100644 --- a/view.c +++ b/view.c @@ -8,6 +8,7 @@ #define _POSIX_C_SOURCE 200809L +#include #include #include #include @@ -163,9 +164,6 @@ view_init(struct cg_view *view, struct cg_server *server, enum cg_view_type type struct cg_view * view_from_wlr_surface(struct wlr_surface *surface) { - if (!surface) { - return NULL; - } - + assert(surface); return surface->data; }