fix: bug in osc goto (#44)

This commit is contained in:
Carlos Valente
2021-11-22 22:48:55 +01:00
committed by GitHub
parent f3320efc5c
commit eb2abb7026
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -654,7 +654,7 @@ export class EventTimer extends Timer {
} }
loadEventById(eventId) { loadEventById(eventId) {
let eventIndex = this._eventlist.findIndex((e) => e.id === eventId); const eventIndex = this._eventlist.findIndex((e) => e.id === eventId);
if (eventIndex === -1) return; if (eventIndex === -1) return;
this.pause(); this.pause();
@@ -662,7 +662,7 @@ export class EventTimer extends Timer {
} }
loadEventByIndex(eventIndex) { loadEventByIndex(eventIndex) {
if (eventIndex === -1 || index > this.numEvents) return; if (eventIndex === -1 || eventIndex > this.numEvents) return;
this.pause(); this.pause();
this.loadEvent(eventIndex, 'load', true); this.loadEvent(eventIndex, 'load', true);
} }
+3 -3
View File
@@ -71,7 +71,7 @@ export const initiateOSC = (config) => {
case 'delay': case 'delay':
console.log('calling delay with', args); console.log('calling delay with', args);
try { try {
let t = parseInt(args); const t = parseInt(args);
if (isNaN(t)) { if (isNaN(t)) {
console.error(`OSC IN: delay time not recognised ${args}`); console.error(`OSC IN: delay time not recognised ${args}`);
return; return;
@@ -84,13 +84,13 @@ export const initiateOSC = (config) => {
case 'goto': case 'goto':
console.log('calling goto with', args); console.log('calling goto with', args);
try { try {
let eventIndex = parseInt(args); const eventIndex = parseInt(args);
if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null) { if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null) {
console.error( console.error(
`OSC IN: event index not recognised or out of range ${eventIndex}` `OSC IN: event index not recognised or out of range ${eventIndex}`
); );
} }
global.timer.loadEventByIndex(eventIndex - 1, undefined, true); global.timer.loadEventByIndex(eventIndex - 1);
} catch (error) { } catch (error) {
console.log('error calling goto: ', error); console.log('error calling goto: ', error);
} }