aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-11-05 18:31:41 +0100
committerBrian Ashworth <bosrsf04@gmail.com>2019-11-05 13:35:56 -0500
commit01b5350bdcbe5c26f94f5fff9d72da955f56d7b3 (patch)
tree2743d9d21dbfcd02bc41dbb01094da046859ffc5
parentf33dcd4c604fa24058f6cbaf692831420dc5db67 (diff)
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")
-rw-r--r--sway/config/output.c4
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,
best = mode;
break;
}
- best = mode->refresh > best->refresh ? mode : best;
+ if (best == NULL || mode->refresh > best->refresh) {
+ best = mode;
+ }
}
}
if (!best) {