aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2018-02-09 22:50:50 +0100
committerAhmad Fatoum <ahmad@a3f.at>2018-02-09 22:54:35 +0100
commit468309d06c7ac3e3278057cfb1cfc19b332833bf (patch)
tree771e3e932366b84e789cc4217e419b00cc6287b4 /src
parentf72b315cb66de68486a8cf41a2767902aceb9c67 (diff)
downloadraylib-468309d06c7ac3e3278057cfb1cfc19b332833bf.tar.gz
raylib-468309d06c7ac3e3278057cfb1cfc19b332833bf.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c
index 0a1c34c9..d6a10943 100644
--- a/src/core.c
+++ b/src/core.c
@@ -441,12 +441,13 @@ void InitWindow(int width, int height, void *data)
uwpWindow = (EGLNativeWindowType)data;
#endif
+ // Init hi-res timer
+ InitTimer();
+
// Init graphics device (display device and OpenGL context)
// NOTE: returns true if window and graphic device has been initialized successfully
windowReady = InitGraphicsDevice(width, height);
-
- // Init hi-res timer
- InitTimer();
+ if (!windowReady) return;
#if defined(SUPPORT_DEFAULT_FONT)
// Load default font