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.
This commit is contained in:
David Capello 2012-03-19 21:05:04 -03:00
parent 7771d3fb17
commit f1180e7a71

View File

@ -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);