summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-09-08 15:43:20 -0500
committerLeonardo Hernández <leohdz172@protonmail.com>2022-10-29 16:48:50 -0500
commit846ce52b926797dc51f9fcdc2d121ee63fb68580 (patch)
tree0a762d68d70df525d89ea898f81920fbde45f849
parenta9e2ebaf4163278086d2cc290f164028dec0839b (diff)
fix crash in dirtomon() when selmon is disabled
-rw-r--r--dwl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dwl.c b/dwl.c
index 85edb9d..2baa659 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1152,10 +1152,12 @@ Monitor *
dirtomon(enum wlr_direction dir)
{
struct wlr_output *next;
- if ((next = wlr_output_layout_adjacent_output(output_layout,
+ if (wlr_output_layout_get(output_layout, selmon->wlr_output)
+ && (next = wlr_output_layout_adjacent_output(output_layout,
dir, selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data;
- if ((next = wlr_output_layout_farthest_output(output_layout,
+ if (wlr_output_layout_get(output_layout, selmon->wlr_output)
+ && (next = wlr_output_layout_farthest_output(output_layout,
dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT),
selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data;