diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-13 19:58:07 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-13 19:58:07 (GMT) |
commit | 42d17beefae4ce3ac7beb048a89065ed3f7c3658 (patch) | |
tree | dd118702b675ed912b95019163ce852d5198210a /scripts | |
parent | 4a0eba244536b7aa731e0e41ef1572eb24cfe773 (diff) |
Fix segfault when running under Xvfb
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/list-outputs.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/list-outputs.c b/scripts/list-outputs.c index f2c3f0b..183258c 100644 --- a/scripts/list-outputs.c +++ b/scripts/list-outputs.c @@ -12,14 +12,16 @@ int main(int argc, char **argv) rr = XRRGetScreenResources(dpy, DefaultRootWindow(dpy)); - for (i = 0; i < rr->noutput; i++) { - output = XRRGetOutputInfo(dpy, rr, rr->outputs[i]); + if (rr != NULL) { + for (i = 0; i < rr->noutput; i++) { + output = XRRGetOutputInfo(dpy, rr, rr->outputs[i]); - if (output->connection == RR_Connected) { - printf("%s\n", output->name); - } + if (output->connection == RR_Connected) { + printf("%s\n", output->name); + } - XRRFreeOutputInfo(output); + XRRFreeOutputInfo(output); + } } XRRFreeScreenResources(rr); |