aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-04-15 07:04:28 +0900
committerDevine Lu Linvega <[email protected]>2019-04-15 07:04:28 +0900
commit54c199146e6cabc472d839e0ee8d7e2cb62652ae (patch)
tree8ab66a6c9d32313a66e8d47e7c75bf3529a47607
parent7e2eaa76a19e7717e86e6d94bba0eb56af3e5327 (diff)
downloadOrca-54c199146e6cabc472d839e0ee8d7e2cb62652ae.tar.gz
Orca-54c199146e6cabc472d839e0ee8d7e2cb62652ae.zip
More secure setFrame
-rw-r--r--desktop/sources/scripts/clock.js3
-rw-r--r--desktop/sources/scripts/commander.js2
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) },