Skip to content

Commit

Permalink
[components] Wrong order of judgment
Browse files Browse the repository at this point in the history
  • Loading branch information
lessone1 authored and mysterywolf committed Apr 15, 2023
1 parent 2c98ce4 commit 2638a2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/drivers/serial/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,12 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
rt_memset(row_s,0,4);
rt_memset(col_s,0,4);
cnt1 = 0;
while(_tio_buf[cnt1] != ';' && cnt1 < _TIO_BUFLEN)
while(cnt1 < _TIO_BUFLEN && _tio_buf[cnt1] != ';')
{
cnt1++;
}
cnt2 = ++cnt1;
while(_tio_buf[cnt2] != ';' && cnt2 < _TIO_BUFLEN)
while(cnt2 < _TIO_BUFLEN && _tio_buf[cnt2] != ';')
{
cnt2++;
}
Expand Down
4 changes: 2 additions & 2 deletions components/drivers/serial/serial_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1316,12 +1316,12 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
rt_memset(row_s,0,4);
rt_memset(col_s,0,4);
cnt1 = 0;
while(_tio_buf[cnt1] != ';' && cnt1 < _TIO_BUFLEN)
while(cnt1 < _TIO_BUFLEN && _tio_buf[cnt1] != ';')
{
cnt1++;
}
cnt2 = ++cnt1;
while(_tio_buf[cnt2] != ';' && cnt2 < _TIO_BUFLEN)
while(cnt2 < _TIO_BUFLEN && _tio_buf[cnt2] != ';')
{
cnt2++;
}
Expand Down

0 comments on commit 2638a2a

Please sign in to comment.