Check that a button mapping is defined before accessing it
This commit is contained in:
parent
c05296fda4
commit
559b180a14
1 changed files with 1 additions and 1 deletions
|
@ -14,7 +14,7 @@ function Buttons(session) {
|
||||||
|
|
||||||
document.addEventListener('keydown', function(event) {
|
document.addEventListener('keydown', function(event) {
|
||||||
var button = session.get('options').layout[event.key];
|
var button = session.get('options').layout[event.key];
|
||||||
if(button != undefined && mapping[button] != undefined) {
|
if(button != undefined && mapping != undefined && mapping[button] != undefined) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
mapping[button]();
|
mapping[button]();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue