Skip to content

Commit

Permalink
Unknown keys should have a -1 code. This catches them and stops the e…
Browse files Browse the repository at this point in the history
…rror from happening. (issue #184)
  • Loading branch information
remuzel authored and Hopson97 committed Mar 27, 2020
1 parent 3317e6c commit 64455d1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/input/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 64455d1

Please sign in to comment.