props: prevent error with empty OSC{} blocks

This commit is contained in:
jean-emmanuel 2021-05-01 09:20:39 +02:00
parent e0cd1bf163
commit daa9038dfe
2 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 1.9.4
- bug fixes
- prevent error with empty `OSC{}` blocks
## 1.9.3
- bug fixes

View file

@ -623,12 +623,16 @@ class Widget extends EventEmitter {
propValue = balancedReplace('OSC{', '}', propValue, (args)=>{
if (args === '') return 'undefined'
let [address, value, usePreArgs] = args.split(',')
.map(x=>x.trim())
.map(x=>x.replace(/VAR_[0-9]+/g, (m)=>{
return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m])
}))
if (!address) return 'undefined'
if (!this.oscReceivers[args]) {
this.oscReceivers[args] = new OscReceiver({
address: address,