Merge pull request #2757 from RyanDwyer/check-focus-stack-empty

Add sanity check for empty focus stack
This commit is contained in:
emersion 2018-10-03 14:17:28 +02:00 committed by GitHub
commit 01b8e171b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -952,6 +952,9 @@ struct sway_node *seat_get_focus(struct sway_seat *seat) {
if (!seat->has_focus) { if (!seat->has_focus) {
return NULL; return NULL;
} }
if (wl_list_length(&seat->focus_stack) == 0) {
return NULL;
}
struct sway_seat_node *current = struct sway_seat_node *current =
wl_container_of(seat->focus_stack.next, current, link); wl_container_of(seat->focus_stack.next, current, link);
return current->node; return current->node;