Skip to content

Commit ce9591c

Browse files
author
Ivan Nastyukhin
committed
Do not play with mutable data
1 parent ccbc8d6 commit ce9591c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/beefcake/buffer/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def length
8787
end
8888

8989
def <<(bytes)
90-
bytes = bytes.force_encoding('BINARY') if bytes.respond_to? :force_encoding
91-
buf << bytes
90+
encoded_bytes = bytes.force_encoding('BINARY') if bytes.respond_to? :force_encoding
91+
buf << (encoded_bytes || bytes)
9292
end
9393

9494
def read(n)

0 commit comments

Comments
 (0)