From: Michael Stapelberg Date: Sun, 14 Oct 2012 18:56:13 +0000 (+0200) Subject: exit with a proper error message when there are no outputs available (Thanks flo) X-Git-Tag: 4.4~52 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=34a5bbb7e9779a7576fdd1e41dd677248c23749d;p=i3%2Fi3 exit with a proper error message when there are no outputs available (Thanks flo) fixes #842 --- diff --git a/src/randr.c b/src/randr.c index a73a94c9..267d6e41 100644 --- a/src/randr.c +++ b/src/randr.c @@ -69,7 +69,7 @@ Output *get_first_output(void) { if (output->active) return output; - return NULL; + die("No usable outputs available.\n"); } /* @@ -647,8 +647,7 @@ void randr_query_outputs(void) { output->active = false; DLOG("Output %s disabled, re-assigning workspaces/docks\n", output->name); - if ((first = get_first_output()) == NULL) - die("No usable outputs available\n"); + first = get_first_output(); /* TODO: refactor the following code into a nice function. maybe * use an on_destroy callback which is implement differently for @@ -736,6 +735,9 @@ void randr_query_outputs(void) { disable_randr(conn); } + /* Verifies that there is at least one active output as a side-effect. */ + get_first_output(); + /* Just go through each active output and assign one workspace */ TAILQ_FOREACH(output, &outputs, outputs) { if (!output->active)