Check that a button mapping is defined before accessing it

This commit is contained in:
Tissevert 2018-12-29 14:45:47 +01:00
parent c05296fda4
commit 559b180a14
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ function Buttons(session) {
document.addEventListener('keydown', function(event) {
var button = session.get('options').layout[event.key];
if(button != undefined && mapping[button] != undefined) {
if(button != undefined && mapping != undefined && mapping[button] != undefined) {
event.preventDefault();
mapping[button]();
}