gamma-randr.c: Apparently error and ver_reply can both be NULL. Check both to

avoid seg faults.
This commit is contained in:
Jon Lund Steffensen
2010-08-18 20:38:02 +02:00
parent d7314d3f65
commit 8491640b54
+5 -2
View File
@@ -62,9 +62,12 @@ randr_init(randr_state_t *state)
xcb_randr_query_version_reply_t *ver_reply =
xcb_randr_query_version_reply(state->conn, ver_cookie, &error);
if (error) {
/* TODO What does it mean when both error and ver_reply is NULL?
Apparently, we have to check both to avoid seg faults. */
if (error || ver_reply == NULL) {
int ec = (error != 0) ? error->error_code : -1;
fprintf(stderr, _("`%s' returned error %d\n"),
"RANDR Query Version", error->error_code);
"RANDR Query Version", ec);
xcb_disconnect(state->conn);
return -1;
}