mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-29 18:29:18 -05:00
exit(3), don't crash, when glfwCreateWindow fails
glfwSetWindowPos was called on a NULL window, triggering an assert inside GLFW. Check for failure and exit cleanly by means of TraceLog(LOG_ERROR instead.
This commit is contained in:
@ -1822,6 +1822,8 @@ static void InitGraphicsDevice(int width, int height)
|
|||||||
// No-fullscreen window creation
|
// No-fullscreen window creation
|
||||||
window = glfwCreateWindow(screenWidth, screenHeight, windowTitle, NULL, NULL);
|
window = glfwCreateWindow(screenWidth, screenHeight, windowTitle, NULL, NULL);
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
// Center window on screen
|
// Center window on screen
|
||||||
int windowPosX = displayWidth/2 - screenWidth/2;
|
int windowPosX = displayWidth/2 - screenWidth/2;
|
||||||
@ -1835,6 +1837,7 @@ static void InitGraphicsDevice(int width, int height)
|
|||||||
renderWidth = screenWidth;
|
renderWidth = screenWidth;
|
||||||
renderHeight = screenHeight;
|
renderHeight = screenHeight;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user