Skip to content

Commit

Permalink
Stop MicroBitSerial::read(ASYNC) dropping bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
martinwork committed May 26, 2019
1 parent 8c2403e commit d84b479
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/drivers/MicroBitSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ int MicroBitSerial::read(uint8_t *buffer, int bufferLen, MicroBitSerialMode mode

if(mode == ASYNC)
{
while((temp = getChar(mode)) != MICROBIT_NO_DATA && bufferIndex < bufferLen)
while(bufferIndex < bufferLen && (temp = getChar(mode)) != MICROBIT_NO_DATA)
{
buffer[bufferIndex] = (char)temp;
bufferIndex++;
Expand Down

0 comments on commit d84b479

Please sign in to comment.