diff options
author | Rob Pike <r@golang.org> | 2011-01-07 14:41:33 -0800 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2011-01-07 14:41:33 -0800 |
commit | 353fd1014c78b3b76fb5233f477677e0333e5f1a (patch) | |
tree | f710627477b8c1f82e0d56e61d6a78fa82088652 | |
parent | 9d634e50c7d9a132897805a8604e15ce7db3de7b (diff) | |
download | go-353fd1014c78b3b76fb5233f477677e0333e5f1a.tar.gz go-353fd1014c78b3b76fb5233f477677e0333e5f1a.zip |
bytes.Buffer: Fix bug in UnreadByte.
Error check was inverted.
Fixes #1396.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/3851042
-rw-r--r-- | src/pkg/bytes/buffer.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go index 55d3133868..2574b4f432 100644 --- a/src/pkg/bytes/buffer.go +++ b/src/pkg/bytes/buffer.go @@ -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 |