Merge pull request #4 from cpvalente/fix/osc

Fix/osc: fixed issue where process would crash when receiving unknown OSC datatypes
This commit is contained in:
Carlos Valente
2021-05-27 20:34:39 +02:00
committed by GitHub
3 changed files with 11 additions and 7 deletions
+6 -2
View File
@@ -5,6 +5,9 @@ const initiateOSC = (config) => {
console.log(`OSC Server is listening on port ${config.port}`); console.log(`OSC Server is listening on port ${config.port}`);
}); });
// error
oscServer.on('error', console.error);
oscServer.on('message', function (msg) { oscServer.on('message', function (msg) {
// message should look like /ontime/{path}/{args} where // message should look like /ontime/{path}/{args} where
// ontime: fixed message for app // ontime: fixed message for app
@@ -62,8 +65,8 @@ const initiateOSC = (config) => {
console.log('calling goto with', args); console.log('calling goto with', args);
try { try {
let eventIndex = parseInt(args); let eventIndex = parseInt(args);
if (isNaN(eventIndex) || eventIndex <= 0) return; if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null)
global.timer.pause(); return;
global.timer.loadEvent(eventIndex - 1, undefined, true); global.timer.loadEvent(eventIndex - 1, undefined, true);
} catch (error) { } catch (error) {
console.log('error calling goto: ', error); console.log('error calling goto: ', error);
@@ -71,6 +74,7 @@ const initiateOSC = (config) => {
break; break;
case 'gotoid': case 'gotoid':
console.log('calling gotoid with', args); console.log('calling gotoid with', args);
if (args == null) return;
try { try {
global.timer.loadEventById(args.toString().toLowerCase()); global.timer.loadEventById(args.toString().toLowerCase());
} catch (error) { } catch (error) {
+1 -1
View File
@@ -8,7 +8,7 @@
"express-session": "~1.17.1", "express-session": "~1.17.1",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
"nanoid": "^3.1.22", "nanoid": "^3.1.22",
"node-osc": "^6.0.1", "node-osc": "6.0.2",
"passport": "~0.4.1", "passport": "~0.4.1",
"passport-local": "~1.0.0", "passport-local": "~1.0.0",
"socket.io": "^4.0.0" "socket.io": "^4.0.0"
+4 -4
View File
@@ -380,10 +380,10 @@ negotiator@0.6.2:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==
node-osc@^6.0.1: node-osc@6.0.2:
version "6.0.1" version "6.0.2"
resolved "https://registry.yarnpkg.com/node-osc/-/node-osc-6.0.1.tgz#6f2c39996c64460435b678dc91c128d3a9711031" resolved "https://registry.yarnpkg.com/node-osc/-/node-osc-6.0.2.tgz#185d387928b186a84e8d0eebcae9e54a8bf50729"
integrity sha512-UZBQGH4vVTw3Ub5/xcnhlrhL6bpaYz3hhNjO4eup4tknyP5qOi2GVVnEmEn/qaTgTvs7SVyytj3OHg9JWRD4Aw== integrity sha512-RW8PRLMh4H14veC5gZVUTcRkrk5pXd+b4vmitWL55c9ZI+5yEvMXkrokfnRH0u7DYveqw4h+uCPIUDifY/vjfA==
dependencies: dependencies:
osc-min "^1.1.1" osc-min "^1.1.1"