mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 14:04:36 +00:00
Fix glfwGetKeyName not checking key token is valid
This commit is contained in:
parent
3f31519de8
commit
b1517e5b3e
@ -701,6 +701,12 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
if (key != GLFW_KEY_UNKNOWN)
|
if (key != GLFW_KEY_UNKNOWN)
|
||||||
{
|
{
|
||||||
|
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (key != GLFW_KEY_KP_EQUAL &&
|
if (key != GLFW_KEY_KP_EQUAL &&
|
||||||
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
|
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
|
||||||
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
|
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
|
||||||
|
Loading…
Reference in New Issue
Block a user