fix issue with buffer padding

This commit is contained in:
2024-10-07 12:56:10 -05:00
parent 753ec6d8df
commit 24e09960d9
+1 -1
View File
@@ -77,7 +77,7 @@ const oscTypeConverterMap: { [key: string]: OSCTypeConverter } = {
const sizeBuffer = oscTypeConverterMap.i.toBuffer(data.length);
if (sizeBuffer) {
const padSize = 4 - (data.length % 4);
const padBuffer = Buffer.from(Array(padSize).fill(0));
const padBuffer = padSize < 4 ? Buffer.from(Array(padSize).fill(0)) : Buffer.from([]);
return Buffer.concat([sizeBuffer, data, padBuffer]);
}
}