Skip to content

Commit

Permalink
fix: safer handling of binding parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Feb 26, 2025
1 parent a7d39ae commit e1f008c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class BluetoothHciSocket extends EventEmitter {
this.reset();
}

bindUser (devId, params, mode = 'user') {
bindUser (devId, params = {}, mode = 'user') {
this._mode = mode;
const uartParams = this._getSerialParams(params);
const { port, baudRate } = uartParams.uart;
const retryConnection = params.retryConnection || 10;
const retryConnection = (params && params.retryConnection) || 10;

if (typeof port !== 'string' || !Number.isInteger(baudRate)) {
throw new Error('Invalid UART parameters');
Expand Down

0 comments on commit e1f008c

Please sign in to comment.