From c32ed921a2d6ee0c5c1857f7e613ab17942b43d8 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 4 Feb 2018 12:31:16 +0100 Subject: [PATCH] Security check in case window initialization fails --- src/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core.c b/src/core.c index ca833ee7..821a2d61 100644 --- a/src/core.c +++ b/src/core.c @@ -633,14 +633,19 @@ bool IsWindowReady(void) bool WindowShouldClose(void) { #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) - // While window minimized, stop loop execution - while (windowMinimized) glfwWaitEvents(); + if (windowReady) + { + // While window minimized, stop loop execution + while (windowMinimized) glfwWaitEvents(); - return (glfwWindowShouldClose(window)); + return (glfwWindowShouldClose(window)); + } + else return true; #endif #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP) - return windowShouldClose; + if (windowReady) return windowShouldClose; + else return true; #endif }