From 98cd11c019e19e3abbc9685fcbc0ec855a4f7531 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 15 Dec 2019 11:51:47 +0100 Subject: output: fix wlr_output_preferred_mode fallback `mode` points to an invalid pointer (head of the list) when the loop stops. Closes: https://github.com/swaywm/sway/issues/4717 --- types/wlr_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index ec29da4f..c9f14688 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -406,7 +406,7 @@ struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output) { } // No preferred mode, choose the last one - return mode; + return wl_container_of(output->modes.prev, mode, link); } static void output_state_clear_buffer(struct wlr_output_state *state) { -- cgit v1.2.3