소스 검색

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.
pull/456/head
Ahmad Fatoum 6 년 전
부모
커밋
44cd4faf83
No known key found for this signature in database GPG 키 ID: C3EAC3DE9321D59B
1개의 변경된 파일11개의 추가작업 그리고 8개의 파일을 삭제
  1. +11
    -8
      src/core.c

+ 11
- 8
src/core.c 파일 보기

@ -1822,18 +1822,21 @@ static void InitGraphicsDevice(int width, int height)
// No-fullscreen window creation
window = glfwCreateWindow(screenWidth, screenHeight, windowTitle, NULL, NULL);
if (window)
{
#if defined(PLATFORM_DESKTOP)
// Center window on screen
int windowPosX = displayWidth/2 - screenWidth/2;
int windowPosY = displayHeight/2 - screenHeight/2;
// Center window on screen
int windowPosX = displayWidth/2 - screenWidth/2;
int windowPosY = displayHeight/2 - screenHeight/2;
if (windowPosX < 0) windowPosX = 0;
if (windowPosY < 0) windowPosY = 0;
if (windowPosX < 0) windowPosX = 0;
if (windowPosY < 0) windowPosY = 0;
glfwSetWindowPos(window, windowPosX, windowPosY);
glfwSetWindowPos(window, windowPosX, windowPosY);
#endif
renderWidth = screenWidth;
renderHeight = screenHeight;
renderWidth = screenWidth;
renderHeight = screenHeight;
}
}
if (!window)

불러오는 중...
취소
저장