messageToBuffer should error on invalid address

This commit is contained in:
2024-10-14 21:15:29 -05:00
parent 1f214396ae
commit 374bf0d39f
+4
View File
@@ -28,6 +28,10 @@ function argsToBuffer(args: OSCArg[]) {
}
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);
if (addressBuffer === undefined) {
throw new Error('problem encoding address');