Browse Source

don't crash when X11 display is missing

rdb 13 years ago
parent
commit
400f22693a

+ 6 - 1
panda/src/glxdisplay/glxGraphicsPipe.cxx

@@ -30,8 +30,13 @@ TypeHandle glxGraphicsPipe::_type_handle;
 ////////////////////////////////////////////////////////////////////
 glxGraphicsPipe::
 glxGraphicsPipe(const string &display) : x11GraphicsPipe(display) {
+  if (_display == None) {
+    // Some error must have occurred.
+    return;
+  }
+
   string display_spec (XDisplayString(_display));
-  
+
   int errorBase, eventBase;
   if (!glXQueryExtension(_display, &errorBase, &eventBase)) {
     glxdisplay_cat.error()

+ 5 - 0
panda/src/x11display/x11GraphicsPipe.cxx

@@ -68,6 +68,11 @@ x11GraphicsPipe(const string &display) {
   if (!_display) {
     x11display_cat.error()
       << "Could not open display \"" << display_spec << "\".\n";
+    _is_valid = false;
+    _screen = None;
+    _root = None;
+    _display_width = 0;
+    _display_height = 0;
     return;
   }