Skip to content

Commit

Permalink
update condition to avoid reading an extra character after len charac…
Browse files Browse the repository at this point in the history
…ters have been read

Signed-off-by: Benjamin Cabé <benjamin@eclipse.org>
  • Loading branch information
Benjamin Cabé committed Dec 20, 2016
1 parent 5ba5ccb commit 192c966
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/bluetooth/MicroBitUARTService.cpp
Expand Up @@ -356,7 +356,7 @@ int MicroBitUARTService::read(uint8_t *buf, int len, MicroBitSerialMode mode)
{
int c;

while((c = getc(mode)) >= 0 && i < len)
while(i < len && (c = getc(mode)) >= 0)
{
buf[i] = c;
i++;
Expand Down

0 comments on commit 192c966

Please sign in to comment.