From 518317b7fc7352de15c18b07f7512c4378975db5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 28 Aug 2015 13:14:53 +1000 Subject: [PATCH] Check for DISPLAY != NULL during scan_devices_xi2 Signed-off-by: Peter Hutterer --- tools/mtview.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/mtview.c b/tools/mtview.c index 27c6ad0..f9c4d70 100644 --- a/tools/mtview.c +++ b/tools/mtview.c @@ -590,6 +590,11 @@ static int scan_devices_xi2(void) int ndevices, i; int deviceid = 0; + if (dpy == NULL) { + printf("Failed to open display\n"); + return -1; + } + XIQueryVersion(dpy, &major, &minor); if (major != 2 && minor < 2) { printf("Unsupported XI2 version. Need 2.2 or newer, have %d.%d\n", major, minor);