Early-exit InitWindow if InitGraphicsDevice fails
Otherwise we may run into LoadDefaultFont and crash in rlLoadTexture Also moves InitTimer() before InitGraphicsDevice(), to allow it to be tested even if InitWindow ultimately fails.
This commit is contained in:
parent
f72b315cb6
commit
468309d06c
1 changed files with 4 additions and 3 deletions
|
@ -441,12 +441,13 @@ void InitWindow(int width, int height, void *data)
|
||||||
uwpWindow = (EGLNativeWindowType)data;
|
uwpWindow = (EGLNativeWindowType)data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Init hi-res timer
|
||||||
|
InitTimer();
|
||||||
|
|
||||||
// Init graphics device (display device and OpenGL context)
|
// Init graphics device (display device and OpenGL context)
|
||||||
// NOTE: returns true if window and graphic device has been initialized successfully
|
// NOTE: returns true if window and graphic device has been initialized successfully
|
||||||
windowReady = InitGraphicsDevice(width, height);
|
windowReady = InitGraphicsDevice(width, height);
|
||||||
|
if (!windowReady) return;
|
||||||
// Init hi-res timer
|
|
||||||
InitTimer();
|
|
||||||
|
|
||||||
#if defined(SUPPORT_DEFAULT_FONT)
|
#if defined(SUPPORT_DEFAULT_FONT)
|
||||||
// Load default font
|
// Load default font
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue