ref: 9275ad46893ce65ad5944c16da573486db28e3db
parent: cdd97cb733b08206fc53a1f374108609b87f7a20
author: Clownacy <[email protected]>
date: Mon Apr 13 09:35:01 EDT 2020
This error should result in failure
--- a/src/Backends/GLFW3/Controller.cpp
+++ b/src/Backends/GLFW3/Controller.cpp
@@ -38,18 +38,22 @@
if (glfwJoystickIsGamepad(joystick_id) == GLFW_TRUE) // Avoid selecting things like laptop touchpads
#endif
{
- printf("Joystick #%d selected\n", joystick_id);
- joystick_connected = TRUE;
- connected_joystick_id = joystick_id;
-
// Set up neutral axes
axis_neutrals = (float*)malloc(sizeof(float) * total_axes);
if (axis_neutrals != NULL)
+ {
for (int i = 0; i < total_axes; ++i)
axis_neutrals[i] = axes[i];
+
+ printf("Joystick #%d selected\n", joystick_id);
+ joystick_connected = TRUE;
+ connected_joystick_id = joystick_id;
+ }
else
- Backend_PrintError("Couldn't allocate memory for axis");
+ {
+ Backend_PrintError("Couldn't allocate memory for joystick axes");
+ }
}
}
}