mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-09-08 23:58:59 +00:00
messageToBuffer should error on invalid address
This commit is contained in:
@@ -28,6 +28,10 @@ function argsToBuffer(args: OSCArg[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function messageToBuffer(message: OSCMessage): Uint8Array {
|
export function messageToBuffer(message: OSCMessage): Uint8Array {
|
||||||
|
if (!message.address.startsWith('/')) {
|
||||||
|
throw new Error('osc message must start with a /');
|
||||||
|
}
|
||||||
|
|
||||||
const addressBuffer = oscTypeConverterMap.s.toBuffer(message.address);
|
const addressBuffer = oscTypeConverterMap.s.toBuffer(message.address);
|
||||||
if (addressBuffer === undefined) {
|
if (addressBuffer === undefined) {
|
||||||
throw new Error('problem encoding address');
|
throw new Error('problem encoding address');
|
||||||
|
|||||||
Reference in New Issue
Block a user