From 21bc0ec09200e401a8ec59c39b9cf391a0dbd8e8 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sat, 5 Mar 2022 08:00:39 +0100 Subject: [PATCH] wlr_output_layout_contains_point: handle outputs that aren't in the layout Instead of crashing, return `false` when the specified output isn't part of the layout, as we can be sure that it doesn't contain the specified point. (cherry picked from commit 13fcdba75cf5f21cfd49c1a05f4fa62f77619b40) Gbp-Pq: Topic upstream Gbp-Pq: Name wlr_output_layout_contains_point-handle-outputs-that.patch --- types/wlr_output_layout.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index eb672f06e..f0f546da8 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -242,6 +242,9 @@ bool wlr_output_layout_contains_point(struct wlr_output_layout *layout, if (reference) { struct wlr_output_layout_output *l_output = wlr_output_layout_get(layout, reference); + if (!l_output) { + return false; + } struct wlr_box *box = output_layout_output_get_box(l_output); return wlr_box_contains_point(box, lx, ly); } else { -- GitLab