mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-08-14 19:53:43 +00:00
fix issue with buffer padding
This commit is contained in:
+1
-1
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user