Merge pull request #253 from kartben/fix-uart-read

fix for issue #252: bug in MicroBitUARTService#read when buffer conta…
This commit is contained in:
Joe Finney 2017-01-06 17:09:04 +00:00 committed by GitHub
commit f569f5f6d1

View file

@ -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++;