mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -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
10
src/Window.c
10
src/Window.c
@ -1481,6 +1481,16 @@ static void Window_DoShowDialog(const char* title, const char* msg) {
|
|||||||
X11Window w = { 0 };
|
X11Window w = { 0 };
|
||||||
dpy = win_display;
|
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);
|
X11_MessageBox(title, msg, &w);
|
||||||
X11Window_Free(&w);
|
X11Window_Free(&w);
|
||||||
XFlush(dpy); /* flush so window disappears immediately */
|
XFlush(dpy); /* flush so window disappears immediately */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user