Skip to content

Commit de50402

Browse files
Check if video mode is valid and rename to match with other methods (#5235)
1 parent b9e7cb6 commit de50402

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/platforms/rcore_desktop_glfw.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,11 @@ int GetMonitorRefreshRate(int monitor)
959959

960960
if ((monitor >= 0) && (monitor < monitorCount))
961961
{
962-
const GLFWvidmode *vidmode = glfwGetVideoMode(monitors[monitor]);
963-
refresh = vidmode->refreshRate;
962+
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitor]);
963+
964+
if (mode) refresh = mode->refreshRate;
965+
else TRACELOG(LOG_WARNING, "GLFW: Failed to find video mode for selected monitor");
966+
964967
}
965968
else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor");
966969

0 commit comments

Comments
 (0)