Skip to content

Commit b9e4006

Browse files
committed
fix(desktop): prevent illegal baud rate from being passed as parameter
1 parent 6a2e916 commit b9e4006

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

desktop/src/renderer/src/components/device-modal/serial-port.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ export const SerialPort = ({ setMsg }: SerialPortProps): ReactElement => {
8080
setIsFailed(false)
8181
setMsg('')
8282

83-
const rate = customBaudRate ?? baudRate
83+
let rate = baudRate
84+
if (customBaudRate && !baudRateOptions.some(option => option.value === customBaudRate)) {
85+
rate = customBaudRate
86+
}
87+
8488
const success = await window.electron.ipcRenderer.invoke(IpcEvents.OPEN_SERIAL_PORT, port, rate)
8589

8690
if (success) {

0 commit comments

Comments
 (0)