diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-15 07:04:28 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-15 07:04:28 +0900 |
commit | 54c199146e6cabc472d839e0ee8d7e2cb62652ae (patch) | |
tree | 8ab66a6c9d32313a66e8d47e7c75bf3529a47607 | |
parent | 7e2eaa76a19e7717e86e6d94bba0eb56af3e5327 (diff) | |
download | Orca-54c199146e6cabc472d839e0ee8d7e2cb62652ae.tar.gz Orca-54c199146e6cabc472d839e0ee8d7e2cb62652ae.zip |
More secure setFrame
-rw-r--r-- | desktop/sources/scripts/clock.js | 3 | ||||
-rw-r--r-- | desktop/sources/scripts/commander.js | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js index 03f3a81..fe6f9e3 100644 --- a/desktop/sources/scripts/clock.js +++ b/desktop/sources/scripts/clock.js @@ -78,7 +78,8 @@ function Clock (terminal) { } this.setFrame = function (f) { - terminal.orca.f = clamp(f,0,9999999) + if (isNaN(f)) { return } + terminal.orca.f = clamp(f, 0, 9999999) } // UI diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js index 5b902ff..57d3aa2 100644 --- a/desktop/sources/scripts/commander.js +++ b/desktop/sources/scripts/commander.js @@ -39,6 +39,8 @@ function Commander (terminal) { 'play': (val) => { terminal.clock.play() }, 'stop': (val) => { terminal.clock.stop() }, 'time': (val) => { terminal.clock.setFrame(parseInt(val)) }, + 'next': (val) => { terminal.clock.setFrame(parseInt(val)) }, + 'back': (val) => { terminal.clock.setFrame(parseInt(val)) }, 'goto': (val) => { terminal.cursor.goto(val) }, 'run': (val) => { terminal.run() }, 'bpm': (val) => { terminal.clock.set(parseInt(val), parseInt(val), true) }, |