diff --git a/server/index.js b/server/index.js index 2676a58..0fc1ab7 100644 --- a/server/index.js +++ b/server/index.js @@ -74,7 +74,7 @@ function connectToSerial() { serialport.write('x\n'); serialport.on('data', (data) => { - if (data.startsWith('OK')) { + if (data && data.startsWith('OK')) { okReceived = true; // Send the remaining commands