aboutsummaryrefslogtreecommitdiff
path: root/examples/simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/simple.c')
-rw-r--r--examples/simple.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/simple.c b/examples/simple.c
index d3424036..e64289fb 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -76,8 +76,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (wl_list_length(&output->modes) > 0) {
- struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link);
+ if (!wl_list_empty(&output->modes)) {
+ struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode);
}
sample_output->output = output;