aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2018-02-08 12:00:27 +0100
committerAhmad Fatoum <ahmad@a3f.at>2018-02-08 12:06:21 +0100
commita976e76ae644cb10002900519e2a72bd2706348f (patch)
treeaa2e1cfa64384f91e09c2eea0ab52cb8d4aac1d8 /src
parent4d5d1e0434497d5755fb596675554a8cee74f9f8 (diff)
downloadraylib-a976e76ae644cb10002900519e2a72bd2706348f.tar.gz
raylib-a976e76ae644cb10002900519e2a72bd2706348f.zip
InitWindow: return false if no monitor found
Otherwise we run into an assertion failure inside GLFW's glfwGetVideoMode. Example: http://www.cpantesters.org/cpan/report/b4ba5894-0bdb-11e8-841e-2c60b04e1d2d This is related to #456.
Diffstat (limited to 'src')
-rw-r--r--src/core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index 29f9a23a..0a1c34c9 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1733,7 +1733,13 @@ static bool InitGraphicsDevice(int width, int height)
// NOTE: Getting video modes is not implemented in emscripten GLFW3 version
#if defined(PLATFORM_DESKTOP)
// Find monitor resolution
- const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
+ GLFWmonitor *monitor = glfwGetPrimaryMonitor();
+ if (!monitor)
+ {
+ TraceLog(LOG_WARNING, "Failed to get monitor");
+ return false;
+ }
+ const GLFWvidmode *mode = glfwGetVideoMode(monitor);
displayWidth = mode->width;
displayHeight = mode->height;