aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Krzyszkowiak <dos@dosowisko.net>2022-03-05 08:00:39 +0100
committerSimon Ser <contact@emersion.fr>2022-03-11 06:49:49 +0000
commit13fcdba75cf5f21cfd49c1a05f4fa62f77619b40 (patch)
tree24989c6081d94d67ee795bc054277fb716b75fab
parent2dd121235ea4c3f37c83ef19bb87aa11448fb40d (diff)
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.
-rw-r--r--types/wlr_output_layout.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index 28d91e8d..ef6e2850 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -231,6 +231,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 output_box;
output_layout_output_get_box(l_output, &output_box);
return wlr_box_contains_point(&output_box, lx, ly);