From d0106fcd23c3f7dc04f65baf84b44ae541c54a12 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 22 Oct 2018 18:11:45 +0200 Subject: [PATCH] swaybg: don't abort when output doesn't exist This can happen because of race conditions. It's better to just exit instead of aborting and generating a coredump. --- swaybg/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swaybg/main.c b/swaybg/main.c index 45b7a913a..4e28f9044 100644 --- a/swaybg/main.c +++ b/swaybg/main.c @@ -232,7 +232,12 @@ int main(int argc, const char **argv) { struct wl_registry *registry = wl_display_get_registry(state.display); wl_registry_add_listener(registry, ®istry_listener, &state); wl_display_roundtrip(state.display); - assert(state.compositor && state.layer_shell && state.output && state.shm); + assert(state.compositor && state.layer_shell && state.shm); + + if (state.output == NULL) { + wlr_log(WLR_ERROR, "Could not find output %d", args.output_idx); + return 1; + } // Second roundtrip to get output properties wl_display_roundtrip(state.display);