Skip to content

Commit

Permalink
Solve serial crash (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Jun 13, 2017
1 parent 895d9d2 commit 95de9d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions serialport.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ func (p *serport) reader() {
break
}

ch = append(buffered_ch.Bytes(), ch[:n]...)
n += len(buffered_ch.Bytes())
buffered_ch.Reset()
if err == nil {
ch = append(buffered_ch.Bytes(), ch[:n]...)
n += len(buffered_ch.Bytes())
buffered_ch.Reset()
}

// read can return legitimate bytes as well as an error
// so process the bytes if n > 0
Expand Down

0 comments on commit 95de9d6

Please sign in to comment.