From 0e8620f8a0d71a843a2823c0fa1005325fe7e0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cicho=C5=84?= Date: Wed, 12 Jul 2017 23:25:38 +0200 Subject: [PATCH] Avoid crash by using _glfwPlatformPollJoystick() as intended in joystick diconnection code. --- src/win32_joystick.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/win32_joystick.c b/src/win32_joystick.c index 759d1d44a..d6bd6c5d4 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -576,11 +576,14 @@ void _glfwDetectJoystickConnectionWin32(void) void _glfwDetectJoystickDisconnectionWin32(void) { int jid; + _GLFWjoystick* js; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (_glfw.joysticks[jid].present) - _glfwPlatformPollJoystick(jid, _GLFW_POLL_PRESENCE); + js = &_glfw.joysticks[jid]; + + if (js->present) + _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); } }