cursor: Fix crash when creating a cursor constraint

Fix crash when creating a cursor constraint and there is no currently
focused view.

Fixes a crash starting Warhammer 40,000: Dawn of War II (15620)
This commit is contained in:
Joshua Ashton 2022-07-14 02:19:36 +00:00 committed by Consolatis
parent 79b1630724
commit a74060381b

View file

@ -410,7 +410,7 @@ create_constraint(struct wl_listener *listener, void *data)
wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy); wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy);
view = desktop_focused_view(server); view = desktop_focused_view(server);
if (view->surface == wlr_constraint->surface) { if (view && view->surface == wlr_constraint->surface) {
constrain_cursor(server, wlr_constraint); constrain_cursor(server, wlr_constraint);
} }
} }