diff options
author | Simon Ser <contact@emersion.fr> | 2019-11-05 18:31:41 +0100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-11-05 13:35:56 -0500 |
commit | 01b5350bdcbe5c26f94f5fff9d72da955f56d7b3 (patch) | |
tree | 2743d9d21dbfcd02bc41dbb01094da046859ffc5 /sway/config | |
parent | Prefer higher refresh rate default modes (diff) | |
download | sway-01b5350bdcbe5c26f94f5fff9d72da955f56d7b3.tar.gz sway-01b5350bdcbe5c26f94f5fff9d72da955f56d7b3.tar.zst sway-01b5350bdcbe5c26f94f5fff9d72da955f56d7b3.zip |
Fix segfault in set_mode
best is NULL prior to being assigned to a mode.
Closes: https://github.com/swaywm/sway/issues/4705
Fixes: f33dcd4c604f ("Prefer higher refresh rate default modes")
Diffstat (limited to 'sway/config')
-rw-r--r-- | sway/config/output.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 6c716ccb..a30d7954 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -222,7 +222,9 @@ static bool set_mode(struct wlr_output *output, int width, int height, | |||
222 | best = mode; | 222 | best = mode; |
223 | break; | 223 | break; |
224 | } | 224 | } |
225 | best = mode->refresh > best->refresh ? mode : best; | 225 | if (best == NULL || mode->refresh > best->refresh) { |
226 | best = mode; | ||
227 | } | ||
226 | } | 228 | } |
227 | } | 229 | } |
228 | if (!best) { | 230 | if (!best) { |