From 64455d14b67d6be36cd4e8f7de990202fc3ec5cd Mon Sep 17 00:00:00 2001 From: Remi Date: Fri, 27 Mar 2020 21:43:43 +0000 Subject: [PATCH] Unknown keys should have a -1 code. This catches them and stops the error from happening. (issue #184) --- src/client/input/keyboard.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/input/keyboard.cpp b/src/client/input/keyboard.cpp index c959cd7d..337dd24a 100644 --- a/src/client/input/keyboard.cpp +++ b/src/client/input/keyboard.cpp @@ -10,11 +10,13 @@ void Keyboard::update(sf::Event e) m_recentlyReleased = sf::Keyboard::KeyCount; switch (e.type) { case sf::Event::KeyReleased: + if (e.key.code == -1) return; m_recentlyReleased = e.key.code; m_keys[e.key.code] = false; break; case sf::Event::KeyPressed: + if (e.key.code == -1) return; m_keys[e.key.code] = true; break;