mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
If we weren't able to open an X11 display, fallback to printing to stdout instead of just unhelpfully dying from a segfault.
This commit is contained in:
parent
88af4d7c83
commit
94bf399ddf
12
src/Window.c
12
src/Window.c
@ -1480,7 +1480,17 @@ static void X11_MessageBox(const char* title, const char* text, X11Window* w) {
|
||||
static void Window_DoShowDialog(const char* title, const char* msg) {
|
||||
X11Window w = { 0 };
|
||||
dpy = win_display;
|
||||
|
||||
|
||||
/* Failing to create a display means can't display a message box. */
|
||||
/* However the user might have launched the game through terminal, */
|
||||
/* so fallback to console instead of just dying from a segfault */
|
||||
if (!dpy) {
|
||||
Platform_LogConst("### MESSAGE ###");
|
||||
Platform_LogConst(title);
|
||||
Platform_LogConst(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
X11_MessageBox(title, msg, &w);
|
||||
X11Window_Free(&w);
|
||||
XFlush(dpy); /* flush so window disappears immediately */
|
||||
|
Loading…
x
Reference in New Issue
Block a user