From f1180e7a71881c95d682c59fea8e14e5892a06bf Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 19 Mar 2012 21:05:04 -0300 Subject: [PATCH] Fix issue #89 "Menu key causes crash". We've to check the keycode returned by readkey(), it must be in the [0,KEY_MAX) range. --- src/gui/manager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/manager.cpp b/src/gui/manager.cpp index d7791eb02..5bea3b404 100644 --- a/src/gui/manager.cpp +++ b/src/gui/manager.cpp @@ -494,8 +494,10 @@ bool jmanager_generate_messages(JWidget manager) msg = jmessage_new_key_related(JM_KEYPRESSED, readkey_value); c = readkey_value >> 8; - old_readed_key[c] = key[c]; - msg->key.repeat = key_repeated[c]++; + if (c >= 0 && c < KEY_MAX) { + old_readed_key[c] = key[c]; + msg->key.repeat = key_repeated[c]++; + } broadcast_key_msg(manager, msg); jmanager_enqueue_message(msg);