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.
This commit is contained in:
emersion 2018-10-22 18:11:45 +02:00
parent cdbfc3338b
commit d0106fcd23
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -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, &registry_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);