]> git.cworth.org Git - apitrace/commitdiff
Print an error message when not able to open X display.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 20 Apr 2011 20:05:16 +0000 (21:05 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 20 Apr 2011 20:05:16 +0000 (21:05 +0100)
glws_glx.cpp

index 661e77db4ae1b0a874329fd909126baa58433ade..64f8ce129a41089a75f702c39b6f0359533171d8 100644 (file)
@@ -23,6 +23,9 @@
  *
  **************************************************************************/
 
+#include <stdlib.h>
+#include <iostream>
+
 #include "glimports.hpp"
 #include "glws.hpp"
 
@@ -102,6 +105,10 @@ private:
 public:
     GlxWindowSystem() {
         display = XOpenDisplay(NULL);
+       if (!display) {
+            std::cerr << "error: unable to open display " << XDisplayName(NULL) << "\n";
+            exit(1);
+        }
         screen = DefaultScreen(display);
     }