posix: in __glx_initOpenGL, add null check after XOpenDisplay (#920)

* posix: in `__glx_initOpenGL`, add null check after `XOpenDisplay`

Would segfault when built with GLX enabled and ran in Wayland. Now the same scenario instead falls back to the SoftRasterizer. Still not ideal, but using SDL as a fallback requires considerably more code redesign.

* posix: refine GLX with no X server error message
This commit is contained in:
En-En
2025-08-08 20:54:19 +00:00
committed by GitHub
parent a7812dcea5
commit 75958772ef

View File

@@ -65,6 +65,10 @@ static bool __glx_initOpenGL(const int requestedProfile, const int requestedVers
}
currDisplay = XOpenDisplay(NULL);
if (currDisplay == NULL) {
puts("GLX: Failed to connect to the X display. (GLX requires a compatible X Server.");
return false;
}
int currScreen = DefaultScreen(currDisplay);
int glxMajorVersion = 0;