From 42d17beefae4ce3ac7beb048a89065ed3f7c3658 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Tue, 13 Nov 2012 19:58:07 +0000 Subject: Fix segfault when running under Xvfb --- 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); -- cgit v0.9.1