mirror of
https://github.com/golang/go
synced 2024-11-20 06:04:52 -07:00
bytes.Buffer: Fix bug in UnreadByte.
Error check was inverted. Fixes #1396. R=rsc, adg CC=golang-dev https://golang.org/cl/3851042
This commit is contained in:
parent
9d634e50c7
commit
353fd1014c
@ -291,7 +291,7 @@ func (b *Buffer) UnreadRune() os.Error {
|
||||
// read operation. If write has happened since the last read, UnreadByte
|
||||
// returns an error.
|
||||
func (b *Buffer) UnreadByte() os.Error {
|
||||
if b.lastRead == opReadRune || b.lastRead == opRead {
|
||||
if b.lastRead != opReadRune && b.lastRead != opRead {
|
||||
return os.ErrorString("bytes.Buffer: UnreadByte: previous operation was not a read")
|
||||
}
|
||||
b.lastRead = opInvalid
|
||||
|
Loading…
Reference in New Issue
Block a user