mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 17:03:53 +00:00
fix: error on reading malformed package
This commit is contained in:
committed by
Carlos Valente
parent
8ac5c0a9a2
commit
3d40e31730
@@ -1,14 +1,15 @@
|
||||
import { LogOrigin } from 'ontime-types';
|
||||
|
||||
import { fromBuffer } from 'osc-min';
|
||||
import { fromBuffer, type OscPacketOutput } from 'osc-min';
|
||||
import * as dgram from 'node:dgram';
|
||||
|
||||
import type { IAdapter } from './IAdapter.js';
|
||||
import { logger } from '../classes/Logger.js';
|
||||
import { integrationPayloadFromPath } from './utils/parse.js';
|
||||
import { dispatchFromAdapter } from '../api-integration/integration.controller.js';
|
||||
import { isOntimeCloud } from '../externals.js';
|
||||
|
||||
import { integrationPayloadFromPath } from './utils/parse.js';
|
||||
import type { IAdapter } from './IAdapter.js';
|
||||
|
||||
class OscServer implements IAdapter {
|
||||
private udpSocket: dgram.Socket | null = null;
|
||||
|
||||
@@ -27,7 +28,14 @@ class OscServer implements IAdapter {
|
||||
// params: used to create a nested object to patch with
|
||||
// args: extra data, only used on some API entries
|
||||
|
||||
const msg = fromBuffer(buf);
|
||||
let msg: OscPacketOutput;
|
||||
try {
|
||||
msg = fromBuffer(buf);
|
||||
} catch (_e) {
|
||||
logger.error(LogOrigin.Rx, 'OSC IN: Received invalid OSC message');
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.oscType === 'bundle') {
|
||||
//TODO: manage bundles
|
||||
logger.error(LogOrigin.Rx, `OSC IN: We don't take bundles`);
|
||||
|
||||
Reference in New Issue
Block a user