mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue