glfw-rs
glfw-rs copied to clipboard
Do not crash when the GLFW returns a null pointer to an array.
Many functions in GLFW return NULL when no data is available. Using slice::from_raw_parts() in a null pointer is not correct, return an empty Vec instead.
For example, calling Joystick::get_buttons() in a non-connected joystick would crash the program. I added a few more checks, just in case.