fix crash in dirtomon() when selmon is disabled

This commit is contained in:
Leonardo Hernández Hernández 2022-09-08 15:43:20 -05:00 committed by Leonardo Hernández
parent a9e2ebaf41
commit 846ce52b92

6
dwl.c
View file

@ -1152,10 +1152,12 @@ Monitor *
dirtomon(enum wlr_direction dir) dirtomon(enum wlr_direction dir)
{ {
struct wlr_output *next; 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))) dir, selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data; 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), dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT),
selmon->wlr_output, selmon->m.x, selmon->m.y))) selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data; return next->data;