NoGUI: Don’t segfault when the DISPLAY environment variable isn’t set

This commit is contained in:
Emmanuel Gil Peyrot 2015-04-10 19:07:11 +02:00
parent 1a18cad178
commit 1e7ca7f579
1 changed files with 5 additions and 0 deletions

View File

@ -118,6 +118,11 @@ class PlatformX11 : public Platform
{ {
XInitThreads(); XInitThreads();
dpy = XOpenDisplay(nullptr); dpy = XOpenDisplay(nullptr);
if (!dpy)
{
PanicAlert("No X11 display found");
exit(1);
}
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos, SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,