]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/window.cpp
Don't crash on startup of console programs in monolithic wxX11 build.
[wxWidgets.git] / src / x11 / window.cpp
index 3b569bf98f27e6b2a487cd1b2f5d2b77228485cc..c52af30a5315f82fa63834174af9e6bdf95decb0 100644 (file)
@@ -1747,6 +1747,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxWinModule, wxModule)
 bool wxWinModule::OnInit()
 {
     Display *xdisplay = wxGlobalDisplay();
+    if ( !xdisplay )
+    {
+        // This module may be linked into a console program when using
+        // monolithic library and in this case it's perfectly normal not to
+        // have a display, so just return without doing anything and avoid
+        // crashing below.
+        return true;
+    }
+
     int xscreen = DefaultScreen( xdisplay );
     Window xroot = RootWindow( xdisplay, xscreen );
     g_eraseGC = XCreateGC( xdisplay, xroot, 0, NULL );