swaybg: remove assert crashing on hotplug

When hotplugging, an output may disappear and re-appear. This commit makes it
so swaybg doesn't crash anymore in this case.
This commit is contained in:
emersion 2019-01-19 10:27:47 +01:00
parent 695948e689
commit 1ecc289543
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -194,8 +194,7 @@ static void xdg_output_handle_name(void *data,
struct zxdg_output_v1 *xdg_output, const char *name) {
struct swaybg_output *output = data;
struct swaybg_state *state = output->state;
if (strcmp(name, state->args->output) == 0) {
assert(state->output == NULL);
if (strcmp(name, state->args->output) == 0 && state->output == NULL) {
state->output = output;
}
}